Training Site
Sideways banner

Trout V

Input: Standard Input (stdin)
Output: Standard Output (stdout)
Memory limit: 256 megabytes
Time limit: 0.5 seconds

Hint: This task is only thematically related to the previous Trout tasks.

Following the establishment of a spy network with unbreakable encryption based on TCP (Trout Communication Protocol), the Trout are now wholly focusing their efforts on taking over the whole world.

As it turns out, taking over an entire planet is quite an expensive ordeal. The Trout have incurred a huge number of expenses, for random items such as 1 billion dollars for a mind control device or 2 million dollars for meal worms. The Trout have a list of N expenses, the i-th of which cost d_i dollars and c_i cents. The Trout wish to find out the total sum of all their expenses so far.

The Trout are of course busy taking over the world, and have asked for your help to write a program to calculate their total expenses for them.

The Trout population will certainly be affected by no longer having to worry about their outstanding accounting.

Input

The first line contains a single integer N: the number of expenses.

The following N lines each contain two space separated integers d_i and c_i indicating that the i-th expense cost d_i dollars and c_i cents.

Output

On a single line, output the total cost of all N items, formatted with a dollar sign, exactly two decimal places, and a comma between every group of three digits.

Constraints

  • 1 \le N \le 10,000
  • 0 \le d_i \le 10^{15} and 0 \le c_i \le 99 for all 1 \le i \le N
  • Total expenses will never be more than 10^{15} dollars.

Subtasks

  • Subtask 1 (+26%): The total will be less than \$1,000
  • Subtask 2 (+25%): Each item will cost a whole number of dollars.
  • Subtask 3 (+31%): The total cost will be at most 10,000,000 dollars.
  • Subtask 4 (+18%): No further constraints.

Notes

If you are using a type sensitive language like C++, Java, or C then make sure to use a 64 bit integer type to avoid integer overflow. 64-bit integer types include long long for C or C++, and long for C# or Java.

  • Sample Input 1

    3
    1 72
    0 64
    5 0
    

    Sample Output 1

    $7.36
    
  • Sample Input 2

    4
    12 0
    3 0
    17 0
    82 0
    

    Sample Output 2

    $114.00
    
  • Sample Input 3

    2
    1000000 12
    74000 14
    

    Sample Output 3

    $1,074,000.26