Simple Math Problem

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

요약
주어진 m과 n에 대해 이항계수의 제곱과 또 다른 이항계수의 곱을 두 번 합산한 값을 998244353으로 나눈 나머지로 구한다.
난이도

어려움10점 중 9점

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

문제

Given two positive integers mm and nn, determine the value of the following formula modulo 998,244,353998\\,244\\,353:

∑_i=0⌊m2⌋∑_j=0⌊n2⌋(i+jj)2(m+n−2i−2jn−2j).\sum\_{i=0}^{\left\lfloor\frac{m}{2}\right\rfloor} \sum\_{j=0}^{\left\lfloor\frac{n}{2}\right\rfloor} {i+j \choose j}^2{m+n-2i-2j \choose n-2j}\text{.}

Here, (ab)a \choose b is a binomial coefficient (the number of ways to choose an unordered subset of bb items from a fixed set of aa items).

입력

The first line contains one integer TT (1≤T≤1051 \le T \le 10^5) denoting the number of test cases.

For each test case, the input is a single line containing two integers mm and nn (1≤m,n≤1051 \le m, n \le 10^5).

출력

For each test case, output one line containing one integer: the value of the formula modulo 998,244,353998\\,244\\,353.

예제1

  1. 예제 1

    입력
    2
    1 9
    2 6
    
    예상 출력
    30
    80