Wide Expression

시간 제한1초메모리 제한2048 MB

요약
여섯 인덱스의 모든 범위에서 (ab + cd + 1)^(e XOR f)을 998244353으로 나눈 나머지를 구한다.
난이도

어려움10점 중 9점

유형
수학, 정수론, 조합론, 누적 합
정답자
아직 제출이 없습니다

문제

Evil Arglwyddytywyllwch loves problems where something needs to be summed. Such problems usually have short statements and lack long legends about good and evil characters. He also doesn't like it when to solve a problem, you need to write a thousand numbers in the code. Therefore, he suggested the following problem to you.

Given non-negative integers nn, mm, kk, ll. Calculate

∑_a=0n∑_b=0n∑_c=0m∑_d=0m∑_e=0k∑_f=0l(ab+cd+1)e⊕f mod 998,244,353,\sum\_{a = 0}^{n} \sum\_{b = 0}^{n} \sum\_{c = 0}^{m} \sum\_{d = 0}^{m} \sum\_{e = 0}^{k} \sum\_{f = 0}^{l} {(ab + cd + 1) ^ {e \oplus f}} \bmod 998\\,244\\,353,

where ⊕\oplus is the operation of bitwise exclusive OR (that is, XOR).

입력

The first line contains a single integer TT (1≤T≤1001 \leq T \leq 100), denoting the number of test cases.

Each of the TT following lines contains four integers nn, mm, kk, ll (0≤n,m≤3000 \leq n, m \leq 300, k,l≥0k, l \geq 0, k2+l2≤2023k^2 + l^2 \leq 2023), describing the test case.

It is guaranteed that the sum of the values n2+m2n^2 + m^2 for all test cases does not exceed 2⋅1052 \cdot 10^5.

출력

For each test case, print a single integer: the value of the sum modulo 998,244,353998\\,244\\,353.

예제1

  1. 예제 1

    입력
    6
    0 0 0 0
    0 0 3 6
    1 0 1 0
    1 1 1 1
    25 2 20 23
    99 82 44 3
    
    예상 출력
    1
    28
    9
    80
    950955110
    140425437