AtCoder Grand Contest 051 (Good Bye rng_58 Day 2)
D
C4
AtCoder
⌀ 2807
原题
← CE →
翻译中…

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$.

翻译中…

image

翻译中…

Note

翻译中…

A walk from $S$ to $S$ is a sequence of vertices $v_0 = S, v_1, \ldots, v_k = S$ such that for each $i (0 \leq i < k)$, there is an edge between $v_i$ and $v_{i+1}$. Two walks are considered distinct if they are distinct as sequences.

翻译中…

Constraints

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

Input

翻译中…

Input is given from Standard Input in the following format:

翻译中…

a b c d

翻译中…

Output

翻译中…

Print the answer.

翻译中…

样例

Input #1
2 2 2 2
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$.
Input #2
1 2 3 4
Output #2
0
Input #3
470000 480000 490000 500000
Output #3
712808431
题目信息
题号
agc051_d
时间限制
2 s
内存限制
1024 MB

题面与样例版权归 AtCoder 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。