ChalkBoard

Time limit: 0.7s
Memory limit: 256MB
Input:
Output:

Ș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 xx written on it (xx is initially equal to 11), and he will give qq queries of the following 33 types:

  • Replace xx with (xx multiplied by aa), where aa is given.
  • Replace xx with (xx divided by aa), where aa is given such that it is aa divisor of xx.
  • You are given an interval [l,r][ l, r ]. Find how many numbers dd exist such that dd divides xx, and the prime factors of dd are in the closed interval [l,r][ l, r ]. You need to find the answer modulo 109+710^{9} + 7.

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 qq. The following qq lines will contain one of the following:

  • A number tt which represents the type of query given.
  • If t=1t = 1, then on the same line, a new number aa which represents that xx will be multiplied by aa.
  • If t=2t = 2, then on the same line, a new number aa which represents that xx will be divided by aa. It is guaranteed that number aa will divide xx.
  • If t=3t = 3, then on the same line, two new numbers l,rl, r 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 109+710^{9} + 7.

Constraints and clarifications

  • 1q21051 \leq q \leq 2 \cdot 10^{5}
  • 1a1061 \leq a \leq 10^{6}
  • 1lr1061 \leq l \leq r \leq 10^{6}
# Points Constraints
1 26 1q,a1031 \leq q , a \leq 10^{3}
2 33 1a21051 \leq a \leq 2 \cdot 10^{5}
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 xx is 2×3×3×3×5×5×52 \times 3 \times 3 \times 3 \times 5 \times 5 \times 5, so we can choose the dd in 88, 3232, respectively 1616 ways. Then, for the next queries of the 3rd type, our xx is multiplied by 7×7×117 \times 7 \times 11, so we can choose dd in 2424 ways, respectively 88 ways.

Log in or sign up to be able to send submissions!