#P1207F. Remainder Problem
Remainder Problem
Description
You are given an array consisting of integers (numbered from to ). Initially all elements of are zero.
You have to process two types of queries to this array:
- — increase by ;
- — compute , where is the set of all integers from to which have remainder modulo .
Can you process all the queries?
The first line contains one integer () — the number of queries.
Then lines follow, each describing a query. The -th line contains three integers , and (). If , then it is a query of the first type, , and . If , then it it a query of the second type, , and .
It is guaranteed that there will be at least one query of type .
For each query of type print one integer — the answer to it.
Input
The first line contains one integer () — the number of queries.
Then lines follow, each describing a query. The -th line contains three integers , and (). If , then it is a query of the first type, , and . If , then it it a query of the second type, , and .
It is guaranteed that there will be at least one query of type .
Output
For each query of type print one integer — the answer to it.
Related
In following contests: