#arc178b. B - 1 + 6 = 7

B - 1 + 6 = 7

Score : 600600 points

问题陈述

给定正整数 A1,A2,A3A_{1}, A_{2}, A_{3}。找出满足以下所有条件的正整数元组 (X1,X2,X3)(X_{1}, X_{2}, X_{3}) 的数量,对 998244353998244353 取模。

  • X1X_{1} 是一个正整数,用十进制表示有 A1A_{1} 位数字。
  • X2X_{2} 是一个正整数,用十进制表示有 A2A_{2} 位数字。
  • X3X_{3} 是一个正整数,用十进制表示有 A3A_{3} 位数字。
  • X1+X2=X3X_{1} + X_{2} = X_{3}

输入文件中每个测试用例 TT 个,解决每一个。

以上为大语言模型 kimi 翻译,仅供参考。

Problem Statement

You are given positive integers A1,A2,A3A_{1}, A_{2}, A_{3}. Find the number, modulo 998244353998244353, of tuples of positive integers (X1,X2,X3)(X_{1}, X_{2}, X_{3}) that satisfy all of the following conditions.

  • X1X_{1} is a positive integer with A1A_{1} digits in decimal notation.
  • X2X_{2} is a positive integer with A2A_{2} digits in decimal notation.
  • X3X_{3} is a positive integer with A3A_{3} digits in decimal notation.
  • X1+X2=X3X_{1} + X_{2} = X_{3}.

You are given TT test cases per input file; solve each of them.

Constraints

  • 1T1051 \leq T \leq 10^{5}
  • 1Ai1091 \leq A_{i} \leq 10^{9}
  • All input values are integers.

Input

The input is given from Standard Input in the following format:

TT

case1\text{case}_{1}

case2\text{case}_{2}

\vdots

caseT\text{case}_{T}

Each case is given in the following format:

A1A_{1} A2A_{2} A3A_{3}

Output

Print TT lines. The ii-th line should contain the answer for casei\text{case}_{i}.

Sample Input 1

4
1 1 1
1 6 7
167 167 167
111 666 777

Sample Output 1

36
45
731780675
0

For the first case, tuples such as (X1,X2,X3)=(1,6,7),(2,1,3)(X_{1}, X_{2}, X_{3}) = (1, 6, 7), (2, 1, 3) satisfy the conditions.

On the other hand, tuples such as (X1,X2,X3)=(6,7,13),(3,4,5)(X_{1}, X_{2}, X_{3}) = (6, 7, 13), (3, 4, 5) do not.

There are 3636 tuples (X1,X2,X3)(X_{1}, X_{2}, X_{3}) that satisfy the conditions, so print 3636.

For the third case, remember to print the result modulo 998244353998244353.

For the fourth case, there may be no tuples (X1,X2,X3)(X_{1}, X_{2}, X_{3}) that satisfy the conditions.