Șogard is in huge trouble after his 9-day vacation. He is in urgent need of improving his mathematics skills for his upcoming math exam, so he calls his best friend Richard for some help. Richard came up with the following training routine: he has a chalkboard with the number written on it ( is initially equal to ), and he will give queries of the following types:
- Replace with ( multiplied by ), where is given.
- Replace with ( divided by ), where is given such that it is divisor of .
- You are given an interval . Find how many numbers exist such that divides , and the prime factors of are in the closed interval . You need to find the answer modulo .
Task
Richard prepared the queries in advance, but he forgot to prepare the answers for his queries, and as such, he asks you for help in finding the answers to his queries so that he can help Șogard pass his upcoming math exam.
Input data
The first line of the input will contain the number . The following lines will contain one of the following:
- A number which represents the type of query given.
- If , then on the same line, a new number which represents that will be multiplied by .
- If , then on the same line, a new number which represents that will be divided by . It is guaranteed that number will divide .
- If , then on the same line, two new numbers which represent the interval for the 3rd type of query.
Output data
Print the answer for the 3rd type of queries, in the input order. Note that we want to find each answer modulo .
Constraints and clarifications
# | Points | Constraints |
---|---|---|
1 | 26 | |
2 | 33 | |
3 | 41 | No additional constraints. |
Example
stdin
12
1 5
1 10
1 15
1 9
3 2 3
3 2 5
3 3 5
1 49
1 11
3 5 16
2 77
3 4 16
stdout
8
32
16
24
8
Explanation
For the first query of the 3rd type, the prime decomposition of is , so we can choose the in , , respectively ways. Then, for the next queries of the 3rd type, our is multiplied by , so we can choose in ways, respectively ways.