You are given an array of N elements. Initially all the indices have a value of 0. You have to do four types of works on this array:
Now you have to complete all this tasks.
The first line contains an integer T (T β€ 5) indicating the number of test cases.
Each test case starts with two numbers N & M (1 β€ N, M β€ 100000). N is the number of elements and M is the number of tasks you need to complete.
Next M lines contains one of the following four lines:
For each test case, you have to print βCase X:β on the first line, where X is the case number.
After that for each task of type 4, you need to print a line, summation of all the numbers between π & π inclusive. As the numbers can be very large, you need to answer the sum modulo 100000007.
Input | Output |
---|---|
1 5 6 1 2 4 1 1 4 1 5 2 1 5 2 4 1 5 3 1 3 3 4 1 5 | Case 1: 6 12 15 |
This problem was authored for CodeMask Championship 2016 and is being hosted on Toph per organizerβs request.