#ARC111F. [ARC111F] Do you like query problems?

[ARC111F] Do you like query problems?

Score : 10001000 points

Problem Statement

Yosupo loves query problems. He made the following problem:


A Query Problem

We have an integer sequence of length NN: a1,,aNa_1,\ldots,a_N. Initially, ai=0(1iN)a_i = 0 (1 \leq i \leq N). We also have a variable ansans, which is initially 00. Here, you will be given QQ queries of the following forms:

  • Type 1:
    • ti(=1)t_i (=1) lil_i rir_i viv_i
    • For each j=li,,rij = l_i,\ldots,r_i, aj:=min(aj,vi)a_j := \min(a_j,v_i).
  • ti(=1)t_i (=1) lil_i rir_i viv_i
  • For each j=li,,rij = l_i,\ldots,r_i, aj:=min(aj,vi)a_j := \min(a_j,v_i).
  • Type 2:
    • ti(=2)t_i (=2) lil_i rir_i viv_i
    • For each j=li,,rij = l_i,\ldots,r_i, aj:=max(aj,vi)a_j := \max(a_j,v_i).
  • ti(=2)t_i (=2) lil_i rir_i viv_i
  • For each j=li,,rij = l_i,\ldots,r_i, aj:=max(aj,vi)a_j := \max(a_j,v_i).
  • Type 3:
    • ti(=3)t_i (=3) lil_i rir_i
    • Compute ali++aria_{l_i} + \ldots + a_{r_i} and add the result to ansans.
  • ti(=3)t_i (=3) lil_i rir_i
  • Compute ali++aria_{l_i} + \ldots + a_{r_i} and add the result to ansans.

Print the final value of ansans.

Here, for each query, 11 \leq lil_i \leq rir_i \leq NN holds. Additionally, for Type 1 and 2, 00 \leq viv_i \leq M1M-1 holds.


Maroon saw this problem, thought it was too easy, and came up with the following problem:


Query Problems

Given are positive integers N,M,QN,M,Q. There are ((N+1)N2(M+M+1))Q( \frac{(N+1)N}{2} \cdot (M+M+1) )^Q valid inputs for "A Query Problem". Find the sum of outputs over all those inputs, modulo 998,244,353998{,}244{,}353.


Find it.

Constraints

  • 1N,M,Q2000001 \leq N,M,Q \leq 200000
  • All numbers in input are integers.

Input

Input is given from Standard Input in the following format:

NN MM QQ

Output

Print the answer.

1 2 2
1

There are 2525 valid inputs, and just one of them - shown below - results in a positive value of ansans.

$t_1 = 2, l_1 = 1, r_1 = 1, v_1 = 1, t_2 = 3, l_2 = 1, r_2 = 1$

ansans will be 11 in this case, so the answer is 11.

3 1 4
0
111 112 113
451848306