P23426 [AtCoder] Yet Another ABC String
省选
题目描述

Problem Statement

You are given integers A, B, and C.
How many strings S consisting of A, B, and C satisfy all of the following conditions? Find the count modulo 998244353.

  • The number of occurrences of A, B, and C in S are A, B, and C, respectively.
  • S contains none of ABC, BCA, and CAB as a (contiguous) substring.

Input

Input is given from Standard Input in the following format:
A B C

Output

Print the answer.

Constraints

  • $1 \leq A,B,C \leq 10^6$
  • All values in input are integers.

Sample Input 1

1 1 1

Sample Output 1

3

The three strings that satisfy the conditions are ACB, CBA, and BAC.

Sample Input 2

2 2 2

Sample Output 2

42

Sample Input 3

96 11 46

Sample Output 3

818015722

Sample Input 4

125132 102271 152064

Sample Output 4

128086069

输入格式

见题面 Input 部分

输出格式

见题面 Output 部分

样例输入
1 1 1
样例输出
3