프로그램 명: coci_aladin
제한시간: 8 초

Aladin was walking down the path one day when he found the strangest thing. N empty boxes right next to a weird alien machine. After a bit of fumbling around he got the machine to do something. The machine now accepts 4 integers L, R, A and B. After that hitting the big red glowing button labeled "NE DIRAJ" causes the machine to go crazy and follow the next routine:

During the game Aladin wonders what is the total number of stones in some range of boxes.

입력

출력

For each query beginning with 2 output the answer to that particular query. Queries should be processed in the order they are given in the input.

입출력 예

input

6 3
2 1 6
1 1 5 1 2
2 1 6

output

0
3

input

4 5
1 1 4 3 4
2 1 1
2 2 2
2 3 3
2 4 4

output

3
2
1
0

input

4 4
1 1 4 7 9
2 1 4
1 1 4 1 1
2 1 4

output

16
0

SAMPLE TESTS

First sample description: The boxes start containing {0, 0, 0, 0, 0, 0}, 0 stones in total. After that the device sets the stones to {1 mod 2, 2 mod 2, 3 mod 2, 4 mod 2, 5 mod 2, 0} = {1,0,1,0,1,0}, or 3 stones in total.
출처: coci 2009/2010 contest1 6/6

[질/답] [제출 현황] [푼 후(0)]
[ 채 점 ] [홈으로]  [뒤 로]