Happiness

아직 제출이 없습니다시간 제한15초메모리 제한512 MB

문제

You are at a local amusement park, and notice a spinning teacup ride. After observing it for a bit, you notice a few interesting things about the ride. 

The ride consists of NN circular teacups, all equally spaced around the circumference of a turntable: for i=0,1,,N1i = 0, 1, \ldots, N - 1, the ii-th teacup is centered at the point which is initially i360Ni \cdot \frac{360}{N} degrees clockwise from North. The turntable is large enough to accommodate all of the teacups without them banging into each other. In each teacup, there are NN people, all equally spaced around the circumference of the teacup: for i=0,1,,N1i = 0, 1, \ldots, N - 1, the ii-th person is located at the point which is initially i360Ni \cdot \frac{360}{N} degrees clockwise from North. As teacups are large enough, consider people as points. In each teacup, for i=0,1,,N1i = 0, 1, \ldots, N - 1, the ii-th person has happiness value v_iv\_i. Note that the people at the same initial position in different teacups have the same happiness value.

Over the course of QQ milliseconds, one of two events happens every millisecond:

  • The turntable rotates k_i360Nk\_i \cdot \frac{360}{N} degrees clockwise. The teacups compensate for that, so that their orientations relative to the exterior of the turntable are not affected.
  • The teacup currently at q_i360Nq\_i \cdot \frac{360}{N} degrees clockwise from North rotates by k_i360Nk\_i \cdot \frac{360}{N} degrees clockwise around its center. The other teacups are not affected.

You want to calculate the total happiness of all people, initially and after every event. The total happiness is the sum of individual people's happiness. If a person with happiness value ww is on a straight line formed by the centers of two teacups, their happiness is equal to ww. Otherwise, their happiness is zero. As the total happiness may be large, please output it modulo 998,244,353998\\,244\\,353

Please write a program to track the total happiness of the participants!

입력

The first line contains two integers NN and QQ (2N200,0002 \le N \le 200\\,000, 1Q200,0001 \le Q \le 200\\,000).

The next line contains NN integers, the values v_0,v_1,,v_N1v\_0, v\_1, \ldots, v\_{N - 1} (1v_i1,000,0001 \le v\_i \le 1\\,000\\,000).

The next QQ lines describe the events. Each line is formatted as either "1 k_ik\_i" (1k_iN1 \le k\_i \le N), indicating the turnable rotates k_i360Nk\_i \cdot \frac{360}{N} degrees clockwise, or "2 q_iq\_i k_ik\_i" (0q_i<N0 \le q\_i < N, 1k_iN1 \le k\_i \le N) indicating the teacup currently at q_i360Nq\_i \cdot \frac{360}{N} degrees (from the top) rotates by k_i360Nk\_i \cdot \frac{360}{N} degrees clockwise about its center.

출력

Output Q+1Q + 1 lines, each one containing the total happiness after 0,1,2,,Q0, 1, 2, \ldots, Q events.

Remember to output the happiness modulo 998,244,353998\\,244\\,353.