{"problem":{"name":"C4","description":{"content":"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, modul","description_type":"Markdown"},"platform":"AtCoder","limit":{"time_limit":2000,"memory_limit":262144},"difficulty":"None","is_remote":true,"is_sync":true,"sync_url":null,"sign":"agc051_d"},"statements":[{"statement_type":"Markdown","content":"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$.\n![image](https://img.atcoder.jp/agc051/48a379ab79ee4edf503b84c8b7984d50.png)\n\n## Constraints\n\n*   $1 \\leq a, b, c, d \\leq 500,000$\n*   All values in the input are integers.\n\n## Input\n\nInput is given from Standard Input in the following format:\n\n$a$ $b$ $c$ $d$\n\n[samples]\n\n## Notes\n\nA 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.","is_translate":false,"language":"English"}],"meta":{"iden":"agc051_d","tags":[],"sample_group":[["2 2 2 2","10\n\nThere 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$."],["1 2 3 4","0"],["470000 480000 490000 500000","712808431"]],"created_at":"2026-03-03 11:01:14"}}