{"raw_statement":[{"iden":"problem statement","content":"For a positive rational number $x$, define $f(x)$ as follows:\n\n> Express $x$ as $\\dfrac{P}{Q}$ using coprime positive integers $P$ and $Q$. $f(x)$ is defined as the value $P\\times Q$.\n\nYou are given a positive integer $N$ and a sequence $A=(A_1,A_2,\\dots,A_{N-1})$ of positive integers of length $N-1$.\nWe call a sequence $S=(S_1,S_2,\\dots,S_N)$ of positive integers of length $N$ a **good sequence** if it satisfies all of the following conditions:\n\n*   For every integer $i$ with $1\\leq i\\leq N-1$, it holds that $f\\left(\\dfrac{S_i}{S_{i+1}}\\right)=A_i$.\n*   $\\gcd(S_1,S_2,\\dots,S_N)=1$.\n\nDefine the **score** of a sequence as the product of all its elements.\nIt can be proved that there are finitely many good sequences. Find the sum, modulo $998244353$, of the scores of all good sequences."},{"iden":"constraints","content":"*   $2\\leq N\\leq 1000$\n*   $1\\leq A_i\\leq 1000$ $(1\\leq i\\leq N-1)$\n*   All input values are integers."},{"iden":"input","content":"The input is given from Standard Input in the following format:\n\n$N$\n$A_1$ $A_2$ $\\dots$ $A_{N-1}$"},{"iden":"sample input 1","content":"6\n1 9 2 2 9"},{"iden":"sample output 1","content":"939634344\n\nFor example, both $(2,2,18,9,18,2)$ and $(18,18,2,1,2,18)$ are good sequences, and both have a score of $23328$.\nThere are a total of $16$ good sequences, and the sum of the scores of all of them is $939634344$."},{"iden":"sample input 2","content":"2\n9"},{"iden":"sample output 2","content":"18\n\nThere are $2$ good sequences, both with a score of $9$."},{"iden":"sample input 3","content":"25\n222 299 229 22 999 922 99 992 22 292 222 229 992 922 22 992 222 222 99 29 92 999 2 29"},{"iden":"sample output 3","content":"192457116\n\nDo not forget to compute the sum modulo $998244353$."}],"translated_statement":null,"sample_group":[],"show_order":["default"],"formal_statement":null,"simple_statement":null,"has_page_source":true}