Racing is for high speed usually. However, sloths enjoy hysteretic racing. They believe being slower could be better for exhibiting racers' skills, and all sloths will drive at the same speed. The winner is the one with the best driving skill throughout the journey.
There is the best fit for the figure: the sloth racer and DMV officer called Flash, in the movie Zootopia. However, we use this AI-generated sloth driver instead to avoid legal issues. The giant race track consists of $$$n$$$ soil grids $$$0, 1, \dots, n - 1$$$ forming a circle, where the next grid of $$$i$$$ is $$$(i + 1) \bmod n$$$. The difficulty of the grid $$$i$$$ is a positive integer $$$d_i$$$, and the grid with lowest difficulty, $$$1$$$, is called a normal grid. The time cost to pass grid $$$i$$$ is defined as follows: if the velocity $$$v$$$ of sloths is higher than $$$\frac 1 {d_i}$$$ (normal grids per second) when entering grid $$$i$$$, the speed is adjusted to $$$\frac 1 {d_i}$$$ due to the laziness of sloths. After that, sloths will take $$$d_i$$$ times more than the normal grid to pass it, i.e., it will cost $$$\frac {d_i} {v}$$$ seconds.
Sometimes, the sloths pay for diligent humans to rebuild the giant race track. There are two kinds of the job that will occur:
To begin a racing game, the judge will choose a start grid $$$s$$$ and the game's total time $$$t$$$ seconds, and the game is organized in the following method:
Since you are not a sloth, you have to do it fast.
The first line of input contains $$$n, q \, (2 \leq n, q \leq 2 \times 10 ^ 5)$$$ separated by a single space, denoting the length of the giant race track and the number of operations and queries.
The second line contains $$$n$$$ integer separated by spaces, the $$$i$$$-th denotes $$$d_{i - 1}$$$, the inital difficulty of the $$$i$$$-th grid.
The following $$$q$$$ lines contain queries and operations. Each line must fall in one of the three kinds:
It's guaranteed that $$$0 \leq l, r \lt n$$$ for all $$$l, r$$$ appeared in the $$$q$$$ lines. We define the intervals $$$[l, r]$$$ precisely as follows:
It's also guaranteed that all difficulties appeared in the input, including $$$d_i, \Delta, d'$$$, are positive integers at most $$$10 ^ 6$$$; the difficulties of grids after each operation are at most $$$10 ^ 6$$$.
In response to each query, you have to output a single integer in a single line denoting your answer.
2 4 1 2 Q 0 0 Q 0 1 Q 0 4 Q 0 5
0 1 1 0
5 7 2 5 1 4 3 Q 3 28 Q 0 39 P 4 0 3 Q 2 60 R 4 1 2 Q 1 22 Q 3 19260817
0 3 0 4 1
In the first sample we illustrate how do we define the boundary. Starting a game at $$$0$$$, it's considered in grid $$$0$$$ for $$$t=0$$$; it's considered in grid $$$1$$$ for $$$t = 1$$$, since it only takes $$$1$$$ second to pass the first grid. Then, the speed of sloths is reduced to $$$\frac 1 2$$$ afterwards, and it needs $$$4$$$ seconds to pass grid $$$1$$$.