atcoder#ABC256F. [ABC256F] Cumulative Cumulative Cumulative Sum

[ABC256F] Cumulative Cumulative Cumulative Sum

Score : 500500 points

Problem Statement

You are given NN, QQ, and A=(A1,,AN)A=(A_1,\ldots,A_N). Process QQ queries, each of which is of one of the following two kinds:

  • 1 x v: update AxA_x to vv.
  • 2 x: let Bi=j=1iAjB_i=\sum_{j=1}^{i}A_j, Ci=j=1iBjC_i=\sum_{j=1}^{i}B_j, and Di=j=1iCjD_i=\sum_{j=1}^{i}C_j. Print DxD_x modulo 998244353998244353.

Constraints

  • 1N2×1051 \leq N \leq 2\times10^5
  • 1Q2×1051 \leq Q \leq 2\times10^5
  • 0Ai1090 \leq A_i \leq 10^9
  • 1xN1 \leq x \leq N
  • 0v1090 \leq v \leq 10^9
  • All values in input are integers.

Input

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

NN QQ

A1A_1 A2A_2 \ldots ANA_N

query1{\rm query}_1

query2{\rm query}_2

\vdots

queryQ{\rm query}_Q

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

11 xx vv

22 xx

Output

Print the answer to the queries, with newlines in between.

3 3
1 2 3
2 3
1 2 0
2 3
15
9

When the 11-st query is given, A=(1,2,3)A=(1,2,3), so B=(1,3,6)B=(1,3,6), C=(1,4,10)C=(1,4,10), and D=(1,5,15)D=(1,5,15); thus, D3=15D_3=15.

When the 33-rd query is given, A=(1,0,3)A=(1,0,3), so B=(1,1,4)B=(1,1,4), C=(1,2,6)C=(1,2,6), and D=(1,3,9)D=(1,3,9); thus, D3=9D_3=9.

2 1
998244353 998244353
2 1
0