## Calculate numbers

Time Limit: 2 Second(s)    Memory Limit: 32 MB

Total Submission(s): 71   Accepted Submission(s): 27
Problem Description

Finally after several months’ suffering in the Green Trains, Mr.Bluefly arrives home with a big pack of train tickets. Now he is able to aftertaste the journey. Soon he finds something interesting: The distance between stations various from several km to thousands km. After staring at these tickets for such a long time, he feels that there must be some kind of amazing rule among these numbers. “By calculating GCD and SUM then I can discover them!” he says and pick up the pen and paper and begins calculating. And here is the question: please help him calculate the GCD and SUM of these numbers. If the amazing rule seems not exists, he may modify the number to find the rule(Mr.Bluefly won’t mind it anyway :) ).

Input

An integer T in the first line, then follows T groups of test data.
In each data group, there are two integers n and m in the first line. Then n Integers a~a[n] in the second line are the initial value of the sequence. Then m lines of operations. One operation each line. There are 3 types of operations:
GCD l r :calculate the GCD in section a[l]~a[r].
SUM l r :calculate the SUM in section a[l]~a[r].
SET l r val :set all the numbers in section a[l]~a[r] to the value of val.
(0<=n<=10000,0<=M<=10000,0<=val<=10000)

Output

Each line an integer of an operation’s result behind the command(GCD or SUM).

Sample Input
```1
3 4
5 10 15
GCD 1 3
SUM 1 3
SET 1 3 10
GCD 1 3
```
Sample Output
```GCD 5
SUM 30
GCD 10
```
Source

2014市赛