{"problem":{"name":"Unfair Sugoroku","description":{"content":"Takahashi and Aoki will play a game of sugoroku.   Takahashi starts at point $A$, and Aoki starts at point $B$. They will take turns throwing dice.   Takahashi's die shows $1, 2, \\ldots, P$ with equal","description_type":"Markdown"},"platform":"AtCoder","limit":{"time_limit":2000,"memory_limit":262144},"difficulty":"None","is_remote":true,"is_sync":true,"sync_url":null,"sign":"abc298_e"},"statements":[{"statement_type":"Markdown","content":"Takahashi and Aoki will play a game of sugoroku.  \nTakahashi starts at point $A$, and Aoki starts at point $B$. They will take turns throwing dice.  \nTakahashi's die shows $1, 2, \\ldots, P$ with equal probability, and Aoki's shows $1, 2, \\ldots, Q$ with equal probability.  \nWhen a player at point $x$ throws his die and it shows $i$, he goes to point $\\min(x + i, N)$.  \nThe first player to reach point $N$ wins the game.  \nFind the probability that Takahashi wins if he goes first, modulo $998244353$.\n\nHow to find a probability modulo $998244353$ It can be proved that the sought probability is always rational. Additionally, the constraints of this problem guarantee that, if that probability is represented as an irreducible fraction $\\frac{y}{x}$, then $x$ is indivisible by $998244353$.  \nHere, there is a unique integer $z$ between $0$ and $998244352$ such that $xz \\equiv y \\pmod {998244353}$. Report this $z$.\n\n## Constraints\n\n*   $2 \\leq N \\leq 100$\n*   $1 \\leq A, B < N$\n*   $1 \\leq P, Q \\leq 10$\n*   All values in the input are integers.\n\n## Input\n\nThe input is given from Standard Input in the following format:\n\n$N$ $A$ $B$ $P$ $Q$\n\n[samples]","is_translate":false,"language":"English"}],"meta":{"iden":"abc298_e","tags":[],"sample_group":[["4 2 3 3 2","665496236\n\nIf Takahashi's die shows $2$ or $3$ in his first turn, he goes to point $4$ and wins.  \nIf Takahashi's die shows $1$ in his first turn, he goes to point $3$, and Aoki will always go to point $4$ in the next turn and win.  \nThus, Takahashi wins with the probability $\\frac{2}{3}$."],["6 4 2 1 1","1\n\nThe dice always show $1$.  \nHere, Takahashi goes to point $5$, Aoki goes to point $3$, and Takahashi goes to point $6$, so Takahashi always wins."],["100 1 1 10 10","264077814"]],"created_at":"2026-03-03 11:01:14"}}