You are in charge of adding cheese topping to a pizza prepared for a special customer. This pizza is a very long rectangular strip. It is divided into
You plan to run the machine
The customer is on a diet. When he eats the section of pizza from slice
NOTE FOR PYTHON USERS: If your program receives TLE (time limit exceeded), you should try submitting using the PyPy interpreter: when you are submitting your code, try using "PyPy 3" or "PyPy 2" as the language, instead of "Python 3" or "Python 2".
Input Specification
The first line will contain the integer
The second line will consist of two space-separated integers
The third line will contain the integer
The following
Output Specification
Please output the total number of units of cheese on all of the slices the customer is planning to eat.
Constraints and Partial Marks
For
For the remaining
Sample Input
10
3 5
3
2 6
4 5
3 3
Sample Output
6
Explanation of Sample Output
After running the machine three times, the amount of cheese on each slice of pizza is as follows:
Slice #: 1 2 3 4 5 6 7 8 9 10
Cheese: 0 1 2 2 2 1 0 0 0 0
Therefore, slices
Comments