Moses is planning something and needs your help. Moses has recently been admitted to the Computer Science program at the University of Waterloo. However, the University of Waterloo has been notified that many of their new students enrolled in the Computer Science program are unworthy. To distinguish between the worthy and the unworthy, all applicants have received a math entrance exam. Moses, who is an excellent student, has correctly completed all problems except the last one. He knows that solving all problems will guarantee acceptance to the University of Waterloo but despite being talented in every way possible, Moses is unable to solve the last problem and he requires your help to do so.
Moses is given a function
For all pairs of integers
In other words, to calculate
He is also given the values
Moses needs your help to calculate the value
Constraints
Subtask 1 [10%]
Subtask 2 [10%]
Subtask 3 [80%]
No additional constraints.
Input Specification
The first line of the input contains
The next line contains
Output Specification
Output
Sample Input 1
4 2
24 15 7 3
Sample Output 1
210
Comments