atcoder#ARC160B. [ARC160B] Triple Pair

[ARC160B] Triple Pair

Score : 500500 points

Problem Statement

You are given a positive integer NN.

Find the number, modulo 998244353998244353, of triples of positive integers (x,y,z)(x,y,z) that satisfy the following condition.

  • All of xyxy, yzyz, zxzx are less than or equal to NN.

You have TT test cases to solve.

Constraints

  • 1T1001 \le T \le 100
  • 1N1091 \le N \le 10^9

Input

The input is given from Standard Input in the following format, where casei\mathrm{case}_i represents the ii-th test case:

TT

case1\mathrm{case}_1

case2\mathrm{case}_2

\vdots

caseT\mathrm{case}_T

Each test case is in the following format:

NN

Output

Print TT lines. The ii-th line (1iT)(1 \le i \le T) should contain the answer for the ii-th test case.

4
1
2
5
998244353
1
4
17
727512986

In the first test case, N=1N=1. There is one triple (x,y,z)(x,y,z) that satisfies the condition: (1,1,1)(1,1,1).

In the second test case, N=2N=2. There are four triples (x,y,z)(x,y,z) that satisfy the condition: (1,1,1),(2,1,1),(1,2,1),(1,1,2)(1,1,1),(2,1,1),(1,2,1),(1,1,2).