{"problem":{"name":"Yet Another RGB Sequence","description":{"content":"You are given integers $R$, $G$, $B$, and $K$. How many strings $S$ consisting of `R`, `G`, and `B` satisfy all of the conditions below? Find the count modulo $998244353$. *   The number of occurrenc","description_type":"Markdown"},"platform":"AtCoder","limit":{"time_limit":2000,"memory_limit":262144},"difficulty":"None","is_remote":true,"is_sync":true,"sync_url":null,"sign":"abc266_g"},"statements":[{"statement_type":"Markdown","content":"You are given integers $R$, $G$, $B$, and $K$. How many strings $S$ consisting of `R`, `G`, and `B` satisfy all of the conditions below? Find the count modulo $998244353$.\n\n*   The number of occurrences of `R`, `G`, and `B` in $S$ are $R$, $G$, and $B$, respectively.\n*   The number of occurrences of `RG` as (contiguous) substrings in $S$ is $K$.\n\n## Constraints\n\n*   $1 \\leq R,G,B\\leq 10^6$\n*   $0 \\leq K \\leq \\mathrm{min}(R,G)$\n*   All values in input are integers.\n\n## Input\n\nInput is given from Standard Input in the following format:\n\n$R$ $G$ $B$ $K$\n\n[samples]","is_translate":false,"language":"English"}],"meta":{"iden":"abc266_g","tags":[],"sample_group":[["2 1 1 1","6\n\nThe following six strings satisfy the conditions.\n\n*   `RRGB`\n*   `RGRB`\n*   `RGBR`\n*   `RBRG`\n*   `BRRG`\n*   `BRGR`"],["1000000 1000000 1000000 1000000","80957240\n\nFind the count modulo $998244353$."]],"created_at":"2026-03-03 11:01:14"}}