#C5194. Participant Ranking

    ID: 48816 Type: Default 1000ms 256MiB

Participant Ranking

Participant Ranking

Given \(n\) participants and \(m\) problems, each participant obtains a score for every problem. The total score for the \(i\)-th participant is given by the formula:

\(S_i = \sum_{j=1}^{m} score_{ij}\)

Participants are then ranked in non-increasing order of their total scores. In the event of a tie (i.e. two or more participants having the same total score), the participant with the smaller ID (where participant IDs start from 1) is ranked higher.

Your task is to determine the rank of a specific participant with ID \(p\) given the score matrix.

inputFormat

The input is read from standard input (stdin). The first line contains two space-separated integers \(n\) and \(m\), representing the number of participants and the number of problems, respectively. The following \(n\) lines each contain \(m\) space-separated integers where the \(i\)-th line gives the scores of the \(i\)-th participant on each problem. The last line contains a single integer \(p\) which is the ID of the participant whose rank is to be determined.

outputFormat

Output a single integer to standard output (stdout) which is the rank of participant \(p\) based on the total scores and the tie-breaking rule described above.

## sample
5 3
10 20 30
40 50 60
70 80 90
10 50 20
15 25 35
3
1