By Leandro Zatesko, UFFS Brazil
The Federation of Awkward Cellphones and Erasers (FACE) recently signed a contract with the Federal Government to develop a low cost cellphone which is going to be distributed freely to low-income populations. Despite of being simple, many applications will be available in the device, so people will be able to enjoy all the eases that mobile platforms provide. A challenge, however, is intrigating FACE programmers: the device does not have many hardware resources, and the programmers are facing difficulties in writing the module which will manage the processes of the SBC (System for Beautiful Cellphones) operating system, developed especially for the architeture. The programmers received from the analysts the following directives, which must be strictly followed:
Help FACE to complete SBC writing the module which is missing!
The input consists of many test cases. The first line of each test case consists of a single integer N (1 ≤ N ≤ 105), which represents the number of processes which required their execution to SBC. Each of the N following lines corresponds then to a process and consists of two integers t and c (1 ≤ t, c ≤ 103), which represent respectively the system time when the process has made its requirement and the number of clocks the execution of the process will last. Consider that the system time is counted in clocks and the counter starts in 1 in each test case. Also consider that the input ends in end-of-file (EOF).
For each test case, print the integer value which represents the sum, for all processes, of the time, in clock cycles, that each process waits until starting running. Please note that this value might not fit in 32 bits.
|Sample Input||Sample Output|