P24911 [AtCoder] C4
省选
题目描述

Problem Statement

In the following undirected graph, count the number of walks from S to S that pass through the edges ST, TU, UV, VS (in any direction) exactly a, b, c, d times, respectively, modulo 998,244,353.

Input

Input is given from Standard Input in the following format:
a b c d

Output

Print the answer.

Constraints

  • $1 \leq a, b, c, d \leq 500,000$
  • All values in the input are integers.

Sample Input 1

2 2 2 2

Sample Output 1

10

There are 10 walks that satisfy the condition.
One example of such a walk is
$S \rightarrow T \rightarrow U \rightarrow V \rightarrow U \rightarrow T \rightarrow S \rightarrow V \rightarrow S$.

Sample Input 2

1 2 3 4

Sample Output 2

0

Sample Input 3

470000 480000 490000 500000

Sample Output 3

712808431

输入格式

见题面 Input 部分

输出格式

见题面 Output 部分

样例输入
2 2 2 2
样例输出
10