atcoder#ABC125B. [ABC125B] Resale
[ABC125B] Resale
Score : points
Problem Statement
There are gems. The value of the -th gem is .
You will choose some of these gems, possibly all or none, and get them.
However, you need to pay a cost of to get the -th gem.
Let be the sum of the values of the gems obtained, and be the sum of the costs paid.
Find the maximum possible value of .
Constraints
- All values in input are integers.
Input
Input is given from Standard Input in the following format:
Output
Print the maximum possible value of .
3
10 2 5
6 3 4
5
If we choose the first and third gems, and . We have here, which is the maximum possible value.
4
13 21 6 19
11 30 6 15
6
1
1
50
0