#P3987. 我永远喜欢珂朵莉~
我永远喜欢珂朵莉~
Description
Give Chtholly a non-negative sequence of length , supporting the following two operations:
- : Divide all multiples of in the interval by .
- : Query the sum of elements in the interval .
Chtholly is very cute, so you should help her solve this problem.
Input Format
The first line contains two numbers .
The second line contains non-negative integers .
Then there are lines, each describing one operation:
- : Divide all multiples of in the interval by .
- : Query the sum of elements in the interval .
Output Format
For each query, output one line with one number denoting the answer.
5 3
1 2 3 4 5
2 1 5
1 1 5 2
2 1 5
15
12
Hint
Constraints
, , .
Translated by ChatGPT 5
京公网安备 11011102002149号