#abc256h. [abc256_h]I like Query Problem

[abc256_h]I like Query Problem

Problem Statement

You are given NN, QQ, and A=(a1,ldots,aN)A=(a_1,\\ldots,a_N).
Process QQ queries described below. Each query is of one of the following three kinds:

  • 1 L R x: for i=L,L+1,dots,Ri=L,L+1,\\dots,R, update the value of aia_i to $\\displaystyle \\left\\lfloor \\frac{a_i}{x} \\right\\rfloor$.
  • 2 L R y: for i=L,L+1,dots,Ri=L,L+1,\\dots,R, update the value of aia_i to yy.
  • 3 L R: print displaystylesumi=LRai\\displaystyle\\sum_{i=L}^R a_i.

Constraints

  • 1leqNleq5times1051 \\leq N \\leq 5 \\times 10^5
  • 1leqQleq1051 \\leq Q \\leq 10^5
  • 1leqLleqRleqN1 \\leq L \\leq R \\leq N
  • 1leqaileq1051 \\leq a_i \\leq 10^5
  • 2leqxleq1052 \\leq x \\leq 10^5
  • 1leqyleq1051 \\leq y \\leq 10^5
  • All values in input are integers.

Input

Input is given from Standard Input in the following format, where textqueryi\\text{query}_i denotes the ii-th query to be processed:

NN QQ a1a_1 a2a_2 dots\\dots aNa_N textquery1\\text{query}_1 textquery2\\text{query}_2 vdots\\vdots textqueryQ\\text{query}_Q

Each query is given in one of the following three formats:

11 LL RR xx 22 LL RR yy 33 LL RR

Output

Print the answer to the queries as specified in the Problem Statement, with newlines in between.


Sample Input 1

3 5
2 5 6
3 1 3
1 2 3 2
3 1 2
2 1 2 3
3 1 3

Sample Output 1

13
4
9

Initially, A=(2,5,6)A = (2, 5, 6). Thus, the answer to the 11-st query is a1+a2+a3=2+5+6=13a_1 + a_2 + a_3 = 2 + 5 + 6 = 13.
When the 22-nd query has been processed, A=(2,2,3)A = (2, 2, 3). Thus, the answer to the 33-rd query is a1+a2=2+2=4a_1 + a_2 = 2 + 2 = 4.
When the 44-th query has been processed, A=(3,3,3)A = (3, 3, 3). Thus, the answer to the 55-th query is a1+a2+a3=3+3+3=9a_1 + a_2 + a_3 = 3 + 3 + 3 = 9.


Sample Input 2

6 11
10 3 5 20 6 7
3 1 6
1 2 4 3
3 1 3
2 1 4 10
3 3 6
1 3 6 2
2 1 4 5
3 1 6
2 1 3 100
1 2 5 6
3 1 4

Sample Output 2

51
12
33
26
132