Output: Standard Output (stdout)
Memory limit: 32 megabytes
Time limit: 1.0 seconds
NZOI did our annual shopping trip, and for some odd reason the receipt is missing the total. What a pain!? The treasurer needs the total so that we can correctly do the accounting.
It’d be a simple matter to add them all up, I guess. Oh, wait! The discounts are listed as separate items, and they’re not even negative numbers! What?! This is crazy.
Your job is to write us a program, which given a list of numbers, will add and subtract the discounts and item prices to calculate the total price.
An items price after discount can not be negative. That is, if the discount for an item is greater than the cost of an item, the total price for that item should be zero.
The first line will be a single integer, n, where n is greater than, or equal to 1, and no more than 1000. Following this will be n lines, each line containing the price, p_i and the discount, d_i (with p_i, d_i \leq 1,000,000).
You should output a single integer, t, which is the total cost of the shopping trip.
Explanation for Sample Input 3
There are two items. The first item costs 150 cents, but is discounted by 200 cents. The total cost for this item will be 0. The second item costs 100 cents, and is discounted by 20 cents. The total cost for this item will be 80 cents. Therefore, the answer is 0 + 80, which equals 80 cents.
Sample Input 1
3 67 11 14 3 1031 310
Sample Output 1
Sample Input 2
1 2000 2500
Sample Output 2
Sample Input 3
2 150 200 100 20
Sample Output 3