Under construction

Still being built. Things may change

Simple Math Problem

Time limit1sMemory limit2048 MB

Summary
Given positive integers m and n, compute a double sum of squared binomial products modulo 998244353 for up to 100000 test cases.
Level

Hard8 of 10

Topics
Combinatorics, Math
Solved
No attempts yet

Problem

Given two positive integers mm and nn, compute the following value modulo 998244353:

∑i=0⌊m/2⌋∑j=0⌊n/2⌋(i+jj)2(m+n−2i−2jn−2j)\sum_{i=0}^{\lfloor m/2 \rfloor} \sum_{j=0}^{\lfloor n/2 \rfloor} \binom{i+j}{j}^2 \binom{m+n-2i-2j}{n-2j}

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

Input

The first line contains one integer TT (1≤T≤1051 \le T \le 10^5), the number of test cases. Each test case is a single line containing two integers mm and nn (1≤m,n≤1051 \le m, n \le 10^5).

Output

For each test case, output one line containing the value of the formula modulo 998244353.

Examples1

  1. Example 1

    Input
    2
    1 9
    2 6
    
    Expected output
    30
    80