- Time limit: 2.00 s
- Memory limit: 512 MB
Sometimes Kaaleppi has a bad day. Then he runs on the street and damages some of the buildings.
The street consists of buildings, and for each building you know its initial value. However, after Kaaleppi's run, the value of each building that he damages will be its previous value modulo Kaaleppi's strength on that run.
Your task is to simulate Kaaleppi's runs and calculate the values of the buildings.
Input
The first input line contains two integers and : the number of buildings and the number of queries. The buildings are numbered . The second input line contains numbers : the initial value for each building.
Finally, the input contains lines that describe the queries. The first number in each query is either (Kaaleppi's run) or (calculation).
If the number is , the query contains numbers , and . This means that the values of buildings will change to be their remainders when dividing by . In other words value will become mod if .
If the number is , the query contains numbers and . This means that you should output the sum of the values of buildings .
Output
For each query of type 2, you should output the answer.
Constraints
Example
Input:
6 4 3 4 2 7 9 2 1 1 2 2 2 1 4 1 2 5 3 2 2 6
Output:
10 5