You are given two integer sequences $A_1, A_2, \ldots, A_N$ and $B_1, B_2, \ldots, B_M$. For any two sequences $U_1, U_2, \ldots, U_p$ and $V_1, V_2, \ldots, V_q$, we define
Score(U,V)=∑i=1p∑j=1qUi⋅Vj.Score(U,V)=∑i=1p∑j=1qUi⋅Vj.Score(U, V) = \sum_{i=1}^p \sum_{j=1}^q  U_i \cdot V_j \,.
You should process $Q$ queries of three types:
- $1$ $L$ $R$ $X$: Add $X$ to each of the elements $A_L, A_{L+1}, \ldots, A_R$.
- $2$ $L$ $R$ $X$: Add $X$ to each of the elements $B_L, B_{L+1}, \ldots, B_R$.
- $3$: Print $Score(A, B)$ modulo $998,244,353$.

-----Input-----
- The first line of the input contains a single integer $T$ denoting the number of test cases. The description of $T$ test cases follows.
- The first line of each test case contains two integers, $N$ and $M$, denoting the length of $A$ and $B$ respectively.
- The second line contains $N$ integers, elements of $A$.
- The third line contains $M$ integers, elements of $B$.
- The next line will contain an integer, $Q$, number of queries.
- Each of the next $Q$ lines will contain one of $3$ kinds of updates as mentioned in the statement
It’s guaranteed that each update is a valid update operation.

-----Output-----
For each query of the third type, print a single line containing one integer - the answer to that query.

-----Constraints-----
- $1 \le T \le 10$
- $2 \le N, M, Q \le 10^5$
- $0 \le |A_i|, |B_i|, |X| \le 10^5$

-----Example Input-----
1
3 4
2 -1 5
3 3 2 4
6
3
1 2 3 -2
3
1 1 3 1
2 2 4 2
3

-----Example Output-----
72
24
90

-----Explanation-----
Before the first operation, $A = [2, -1, 5],\ B = [3, 3, 2, 4]$
So, for the first operation,
$Score(A,\ B) = 2*3 + 2*3 + 2*2 + 2*4$ $+ (-1)*3$ $+ (-1)*3$ $+ (-1)*2$ $+$ $(-1)*4$ $+  5*3$ $+ 5*3$ $+ 5*2$ $+ 5*4$ $= 72.$
After the second query $A = [2, -3, 3]$, $B = [3, 3, 2, 4]$
So, for the third query, $Score(A, B) = 2*3 + 2*3 + 2*2$ $+ 2*4$ $+ (-3)*3$ $+ (-3)*3$ $+ (-3)*2$ $+ (-3)*4$ $+  3*3$ $+ 3*3$ $+ 3*2$ $+ 3*4$ $= 24$.

Starter code:

Solutions:
t = int(input())
l,r,x = 0,0,0
ans = []
for i in range(t):
 (n,m) = tuple(map(int,input().split()))
 a = list(map(int,input().split()))
 b = list(map(int,input().split()))
 suma = sum(a)
 sumb = sum(b)
 q = int(input())
 for j in range(q):
  l1 = list(map(int,input().split()))
  if l1[0] == 1:
   l = l1[1]
   r = l1[2]
   x = l1[3]
   suma = suma + (r-l+1)*x
  elif l1[0] == 2:
   l = l1[1]
   r = l1[2]
   x = l1[3]
   sumb = sumb + (r-l+1)*x
  else:
   ans.append((suma*sumb)%998244353)
for i in range(len(ans)):
 print(ans[i])

# cook your dish here
import math
import re 
import os
import sys
input=sys.stdin.readline
for i in range(int(input())):
 a_s=0
 b_s=0
 M=998244353
 ans=0
 n,m=list(map(int,input().split()))
 a=list(map(int,input().split()))
 b=list(map(int,input().split()))
 a_s=sum(a)
 b_s=sum(b)
 q=int(input())
 for i in range(0,q):
  I=list(map(int,input().split()))
  if(I[0]==3):
   ans=(a_s*b_s)%M 
   print(ans)
  else:
   t,l,r,x=list(map(int,I))
   if(t==1):
    a_s=(a_s+(x*(r-l+1)))%M 
   else:
    b_s=(b_s+(x*(r-l+1)))%M


# cook your dish here
import sys
input = sys.stdin.readline
mxn=998244353
for _ in range(int(input())):
 n,m=list(map(int,input().split()))
 a=list(map(int,input().split()))
 b=list(map(int,input().split()))
 s1=sum(a)%mxn
 s2=sum(b)%mxn
 for q in range(int(input())):
  ls=input().split()
  if int(ls[0])==3:print((s1*s2)%mxn)
  else:
   t,l,r,x=list(map(int,ls))
   if t==1:
    s1=(s1+(r-l+1)*x)%mxn
   else:
    s2=(s2+(r-l+1)*x)%mxn



# cook your dish here
import sys
input = sys.stdin.readline
mxn=998244353
for _ in range(int(input())):
 n,m=list(map(int,input().split()))
 a=list(map(int,input().split()))
 b=list(map(int,input().split()))
 s1=sum(a)%mxn
 s2=sum(b)%mxn
 for q in range(int(input())):
  ls=input().split()
  if int(ls[0])==3:print((s1*s2)%mxn)
  else:
   t,l,r,x=list(map(int,ls))
   if t==1:
    s1=(s1+(r-l+1)*x)%mxn
   else:
    s2=(s2+(r-l+1)*x)%mxn



# cook your dish here
import sys

mod = 998244353

input = sys.stdin.readline

t = int(input())
for _ in range(t):
 n, m = list(map(int, input().split()))
 arr1 = [int(j) for j in input().split()]
 arr2 = [int(j) for j in input().split()]

 a = sum(arr1)
 b = sum(arr2)

 q = int(input())
 for i in range(q):
  s = input().split()
  if len(s) == 1:
   print(a*b % mod)
  else:
   num, l, r, x = list(map(int, s))
   if num == 1:
    a += (r-l+1)*x
    a %= mod
   else:
    b += (r-l+1)*x
    b %= mod


import sys

mod = 998244353

input = sys.stdin.readline

t = int(input())
for _ in range(t):
 n, m = list(map(int, input().split()))
 arr1 = [int(j) for j in input().split()]
 arr2 = [int(j) for j in input().split()]

 a = sum(arr1)
 b = sum(arr2)

 q = int(input())
 for i in range(q):
  s = input().split()
  if len(s) == 1:
   print(a*b % mod)
  else:
   num, l, r, x = list(map(int, s))
   if num == 1:
    a += (r-l+1)*x
    a %= mod
   else:
    b += (r-l+1)*x
    b %= mod


import sys

mod = 998244353

input = sys.stdin.readline

t = int(input())
for _ in range(t):
 n, m = list(map(int, input().split()))
 arr1 = [int(j) for j in input().split()]
 arr2 = [int(j) for j in input().split()]

 a = sum(arr1)
 b = sum(arr2)

 q = int(input())
 for i in range(q):
  s = input().split()
  if len(s) == 1:
   print(a*b % mod)
  else:
   num, l, r, x = list(map(int, s))
   if num == 1:
    a += (r-l+1)*x
    a %= mod
   else:
    b += (r-l+1)*x
    b %= mod



# -*- coding: utf-8 -*-
# @Date    : 2020-01-06 07:34:42
# @Author  : raj lath (oorja.halt@gmail.com)
# @Link    : link
# @Version : 1.0.0

import sys
sys.setrecursionlimit(10**5+1)

inf = int(10 ** 20)
max_val = inf
min_val = -inf

RW = lambda : sys.stdin.readline().strip()
RI = lambda : int(RW())
RMI = lambda : [int(x) for x in sys.stdin.readline().strip().split()]
RWI = lambda : [x for x in sys.stdin.readline().strip().split()]


MOD = 998244353
for _ in [0] * RI():
 lenA, lenB = RMI()
 arrA = RMI()
 arrB = RMI()
 sumA, sumB = sum(arrA), sum(arrB)
 for _ in [0] * RI():
  mode,*param = RMI()
  if mode == 3:
   print((sumA % MOD) * (sumB % MOD) % MOD)
  else:
   def adds():
    a, b, c = param
    return c * ( b - a + 1)
   if mode == 1:sumA += adds()
   else:sumB += adds()