Lately, Slavko's been studying sequences of natural numbers. He finds a sequence interesting if the greatest common divisor of all the elements from the sequence is greater than 1.
Yesterday, he found a sequence consisting of
- Change the value at position
in the sequence to . - Determine the number of interesting contiguous subarrays contained in the interval
[L, R]
of the sequence.
Input Specification
The first line of input contains the numbers
The following line contains
Each of the following
- The first number in the line can be
1
or2
and represents the type of the query. - If the query is of type
1
, two numbers follow, and from the task. - If the query is of type
2
, two numbers follow, and that represent the left and right interval boundary.
Output Specification
For each query of type 2
, output the number of interesting contiguous subarrays from the task.
Sample Input 1
5 1
8 4 3 9 1
2 2 5
Sample Output 1
4
Sample Input 2
5 3
2 3 6 4 1
2 1 4
1 3 1
2 3 5
Sample Output 2
6
1
Sample Input 3
4 3
2 2 2 2
2 1 4
1 2 3
2 1 4
Sample Output 3
10
5
Comments