#C13178. Medal Tally

    ID: 42687 Type: Default 1000ms 256MiB

Medal Tally

Medal Tally

You are given a list of medal records from various countries. Each record contains a country's name and the numbers of gold, silver, and bronze medals it earned in a competition. Your task is to calculate the total number of medals each country earned and then output the result in ascending lexicographical order by the country name.

Formally, if there are n records, the first line of input contains the integer n. Then follow n lines, each containing a string (the country name) and three integers (gold, silver, and bronze medals). The total medal count for a country is the sum of its gold, silver, and bronze medals.

The answer for each test case should be printed with one country per line in the format:

Country Total\text{Country}\ \text{Total}

where the countries are sorted in lexicographical order (using standard ASCII order). Note that country names are case-sensitive.

inputFormat

The first line contains a single integer n representing the number of medal records.

Each of the next n lines contains a country's name (a string without spaces) followed by three integers representing the number of gold, silver, and bronze medals, separated by spaces.

outputFormat

For each unique country, output a line containing the country's name and its total medal count, separated by a space. The output should be sorted in ascending lexicographical order of the country names.

## sample
5
USA 10 5 4
Canada 2 3 4
USA 3 6 1
Japan 1 0 1
Canada 5 0 2
Canada 16

Japan 2 USA 29

</p>