Veshy is suffering in AP Physics! He has a series of
which indicates the number of problems on the -th test which indicates the number of points Veshy gets for one correct answer which indicates the number of points Veshy loses for an incorrect or unanswered question which indicates the score Veshy would like to earn on the -th test
For the -1
.
Constraints
In all tests,
Input Specification
The first line contains one integer,
The next
Output Specification
Output
Sample Input
Copy
5
1 4 2 5
9 2 6 4
2 9 3 5
3 5 2 10
8 2 5 7
Sample Output
Copy
-1
8
1
3
7
Comments
Somebody help check my code plzz
The value of
can go up to 
, which exceeds the maximum value for int (
) in java.
Edit: Also you may want to see if there is a way to get the value of j in a faster way.
The answer may overflow int