#P4588. [TJOI2018] 数学计算
[TJOI2018] 数学计算
Description
Xiaodou now has a number , initially . There are operations of two types:
1 m: set to , then output .
2 pos: set to divided by the number multiplied in the -th operation (it is guaranteed that the -th operation is of type 1, and each type 1 operation will be divided at most once), then output .
Input Format
There are test cases.
For each test case, the first line contains two integers .
The next lines each contain an operation, formatted as either 1 m or 2 pos (all inputs are guaranteed to be valid).
Output Format
For each operation, output one line containing the value of after executing the operation.
1
10 1000000000
1 2
2 1
1 2
1 10
2 3
2 4
1 6
1 7
1 12
2 7
2
1
2
20
10
1
6
42
504
84
Hint
For of the testdata, .
For of the testdata, , , , .
Translated by ChatGPT 5
京公网安备 11011102002149号