#K80662. Determining the Winner of a Multi-Event Sports Competition

    ID: 35581 Type: Default 1000ms 256MiB

Determining the Winner of a Multi-Event Sports Competition

Determining the Winner of a Multi-Event Sports Competition

In this problem, you are given the scores of several participants across multiple sports events. Each participant’s performance is evaluated by calculating the total score, which is defined as [ S_i = \sum_{j=1}^{m} a_{ij} ] where (a_{ij}) is the score of the (i)-th participant in the (j)-th event. Your task is to determine the participant with the highest total score. In the case of a tie, the participant with the smaller participant number (ID) is considered the winner.

Input begins with two integers (n) and (m), where (n) denotes the number of participants and (m) denotes the number of events. This is followed by (n) lines, each containing the participant number and the scores for the (m) events.

Your program should read from standard input (stdin) and output the winner's participant number along with their total score to standard output (stdout).

inputFormat

The first line of input contains two integers (n) and (m) separated by a space. Each of the next (n) lines contains (m+1) integers. The first integer is the participant number and the following (m) integers represent that participant's scores in the events.

outputFormat

Output a single line containing two integers: the winner's participant number and the sum of their scores, separated by a space.## sample

4 3
1 30 40 20
2 25 50 30
3 20 60 25
4 25 50 35
2 105