#abc269f. [abc269_f]Numbered Checker

[abc269_f]Numbered Checker

Problem Statement

We have a grid with NN rows and MM columns. The square (i,j)(i,j) at the ii-th row from the top and jj-th column from the left has an integer (i1)timesM+j(i-1) \\times M + j written on it.
Let us perform the following operation on this grid.

  • For every square (i,j)(i,j) such that i+ji+j is odd, replace the integer on that square with 00.

Answer QQ questions on the grid after the operation.
The ii-th question is as follows:

  • Find the sum of the integers written on all squares (p,q)(p,q) that satisfy all of the following conditions, modulo 998244353998244353.
    • AilepleBiA_i \\le p \\le B_i.
    • CileqleDiC_i \\le q \\le D_i.

Constraints

  • All values in the input are integers.
  • 1leN,Mle1091 \\le N,M \\le 10^9
  • 1leQle2times1051 \\le Q \\le 2 \\times 10^5
  • 1leAileBileN1 \\le A_i \\le B_i \\le N
  • 1leCileDileM1 \\le C_i \\le D_i \\le M

Input

The input is given from Standard Input in the following format:

NN MM QQ A1A_1 B1B_1 C1C_1 D1D_1 A2A_2 B2B_2 C2C_2 D2D_2 vdots\\vdots AQA_Q BQB_Q CQC_Q DQD_Q

Output

Print QQ lines.
The ii-th line should contain the answer to the ii-th question as an integer.


Sample Input 1

5 4
6
1 3 2 4
1 5 1 1
5 5 1 4
4 4 2 2
5 5 4 4
1 5 1 4

Sample Output 1

28
27
36
14
0
104

The grid in this input is shown below.

This input contains six questions.

  • The answer to the first question is 0+3+0+6+0+8+0+11+0=280+3+0+6+0+8+0+11+0=28.
  • The answer to the second question is 1+0+9+0+17=271+0+9+0+17=27.
  • The answer to the third question is 17+0+19+0=3617+0+19+0=36.
  • The answer to the fourth question is 1414.
  • The answer to the fifth question is 00.
  • The answer to the sixth question is 104104.

Sample Input 2

1000000000 1000000000
3
1000000000 1000000000 1000000000 1000000000
165997482 306594988 719483261 992306147
1 1000000000 1 1000000000

Sample Output 2

716070898
240994972
536839100

For the first question, note that although the integer written on the square (109,109)(10^9,10^9) is 101810^{18}, you are to find it modulo 998244353998244353.


Sample Input 3

999999999 999999999
3
999999999 999999999 999999999 999999999
216499784 840031647 84657913 415448790
1 999999999 1 999999999

Sample Output 3

712559605
648737448
540261130