Under construction

Still being built. Things may change

Empty Quartz

Time limit2sMemory limit1024 MB

Summary
Count the 0/1 strings of length N where exactly K intervals contain an odd number of 1s, modulo 998244353, for T queries.
Level

Medium5 of 10

Topics
Combinatorics, Prefix sum, Math
Solved
No attempts yet

Problem

NN crystals are aligned in a row. Some of them may be phantoms.

Jun counted the real crystals in every interval [l,r][l, r] with 1≤l≤r≤N1 \le l \le r \le N and recorded whether each count was even or odd.

His N(N+1)2\frac{N(N+1)}{2} records show that there were kk intervals containing an odd number of real crystals. How many possible crystal alignments are there? Output the answer modulo 998244353998244353.

If the ii-th crystal from the left is real in one alignment and a phantom in the other, the two alignments are considered different.

You are given TT problems. Answer each of them.

Input

The first line contains TT. Each of the next TT lines contains NiN_i and KiK_i.

Output

Output TT lines. On line ii, print the answer for N=NiN = N_i and K=KiK = K_i.

Hint

Write a real crystal as 1 and a phantom as 0. For N=3N = 3 and K=4K = 4, the valid alignments are the following three.

  • 0, 1, 0
  • 1, 0, 1
  • 1, 1, 1

Examples2

  1. Example 1

    Input
    1
    3 4
    
    Expected output
    3
    
  2. Example 2

    Input
    5
    5 9
    6 10
    10 24
    10 25
    100000 75915540
    
    Expected output
    10
    21
    165
    0
    651081880