Tudor is buying blocks of cheese. Each block of cheese has a regular price and a discounted price.
Tudor has coupons that allow him to buy a block of cheese for the discounted price instead of the regular price. Each coupon can be used for exactly one block of cheese.
Given that Tudor wants to buy all blocks of cheese, compute the minimum amount of money he must spend.
Constraints
Input Specification
The first line contains two space separated integers, and .
The next lines each contain two space separated integers, and representing the regular price and discounted price of block , respectively.
Output Specification
Output the minimum amount of money Tudor must spend.
Sample Input
2 1
100 0
10 10
Sample Output
10
Comments
This has nothing to do with cutting cheese. What. I mean, I know it's a block of cheese which you can cut, but, like...
It is not the cheese that is being cut, but the price of said cheese.
ohhhh that makes more sense
Can anyone help me with
WA (Presentation Error, check your whitespace)
?I literally just output the answer, there is no whitespace...
You should place a
\n
character at the end of your output.