Rikka generates an integer sequence u_1,u_2,… as follows: she generates x_1,x_2,…, where x_i=(100,000,005⋅x_i−1+20,150,609)mod998,244,353, and then sets u_i=⌊100x_i⌋.
Initially, there are n points on the Cartesian plane. The i-th point has coordinates (i,u_imod100,001). After that, m operations are performed subsequently. The i-th operation has one of the three types: "C", "R", and "Q".
Let p_i=minu_n+2i−1modn,u_n+2imodn+1 and q_i=maxu_n+2i−1modn,u_n+2imodn+1.
C", transform the (u_n+2i−1modn+1)-th point into (u_n+2i−1modn+1,u_n+2imod100,001).R", for all x such that p_i≤x≤q_i, transform the point (x,y) into (x,100,000−y).Q", consider all currently existing points (x,y) such that p_i≤x≤q_i and, given a_i, b_i and c_i, find maxa_i⋅x+b_i⋅y+c_i⋅x⋅y.The first line contains three integers: n, m, and x_0 (1≤n≤105, 1≤m≤106, 0≤x_0<998,244,353, x_0=340,787,122).
The i-th of the following m lines starts with a character t_i, the type of the operation, which is either "C", "R", or "Q". If t_i is "Q", three integers a_i,b_i,c_i follow (0≤a_i,b_i<106, 0≤c_i<40).
It is guaranteed that the number of operations of type Q does not exceed 105.
For each operation of type "Q", output an integer which denotes the maximum.
Initially, the three points lie in (1,91263), (2,33372) and (3,10601) respectively.
The first operation changes the third point to (3,94317).