{"problem":{"name":"Ex - Dice Sum Infinity","description":{"content":"Takahashi has an unbiased six-sided die and a positive integer $R$ less than $10^9$. Each time the die is cast, it shows one of the numbers $1,2,3,4,5,6$ with equal probability, independently of the o","description_type":"Markdown"},"platform":"AtCoder","limit":{"time_limit":2000,"memory_limit":262144},"difficulty":"None","is_remote":true,"is_sync":true,"sync_url":null,"sign":"abc299_h"},"statements":[{"statement_type":"Markdown","content":"Takahashi has an unbiased six-sided die and a positive integer $R$ less than $10^9$. Each time the die is cast, it shows one of the numbers $1,2,3,4,5,6$ with equal probability, independently of the outcomes of the other trials.\nTakahashi will perform the following procedure. Initially, $C=0$.\n\n1.  Cast the die and increment $C$ by $1$.\n2.  Let $X$ be the sum of the numbers shown so far. If $X-R$ is a multiple of $10^9$, quit the procedure.\n3.  Go back to step 1.\n\nFind the expected value of $C$ at the end of the procedure, modulo $998244353$.\n\n## Constraints\n\n*   $0\\lt R\\lt10^9$\n*   $R$ is an integer.\n\n## Input\n\nThe input is given from Standard Input in the following format:\n\n$R$\n\n[samples]\n\n## Notes\n\nUnder the constraints of this problem, it can be shown that the expected value of $C$ is represented as an irreducible fraction $p/q$, and there is a unique integer $x\\ (0\\leq x\\lt998244353)$ such that $xq \\equiv p\\pmod{998244353}$. Print this $x$.","is_translate":false,"language":"English"}],"meta":{"iden":"abc299_h","tags":[],"sample_group":[["1","291034221\n\nThe expected value of $C$ at the end of the procedure is approximately $833333333.619047619$, and $291034221$ when represented modulo $998244353$."],["720357616","153778832"]],"created_at":"2026-03-03 11:01:14"}}