Lelei La Lalena has been studying competitive programming in our world. Today, she decides to do a contest on DMOJ to prove her skill! Confident, Lelei opens the sixth problem of the October 2015 DMOPC and finds a really abstract problem with no story. So she decides to make one up and tell to add it to the problem. Anyway, here's the original problem:
Rory is playing with an array
consisting of integer elements indexed from to and a positive integer . Rory will perform operations. Each operation is either type 1 or type 2. Type 1 operation is in the form
. You should add to each element in . Type 2 operation is in the form
. You should output the sum .
Lelei is confident she can solve this problem, so she tells you that she doesn't need your help, as she can solve it faster than you. Seeing this as a challenge, you obviously want to show Lelei that she could have a better time penalty, if only she asked for your help. Can you prove her wrong?
Input Specification
The first line of input will contain three integers
The second line of input will contain
The next
Constraints
For all subtasks:
Subtask 1 [15%]
Subtask 2 [15%]
Subtask 3 [15%]
Subtask 4 [15%]
Subtask 5 [40%]
Output Specification
For each operation of type 2, output the answer on a new line.
Sample Input
2 5 3
1 2 3 4 5
2 1 4
1 2 5 7
2 1 5
Sample Output
0
1
Explanation
For the first operation,
For the second operation, the array
For the third operation,
Comments
How come the author doesn't mention M as prime ?
Because maybe thats something you can observe yourself?
This comment is hidden due to too much negative feedback. Show it anyway.
No comment, reread the problem statement.
This comment is hidden due to too much negative feedback. Show it anyway.
A link that will take you to the exact same web page?
A comment that will take you to the same comment? Mind = blown!