AtCoder Regular Contest 192 (Div. 2)
D
Fraction Line
AtCoder
⌀ 2722
原题
← CE →
翻译中…

Problem Statement

翻译中…

For a positive rational number $x$, define $f(x)$ as follows:

翻译中…

Express $x$ as $\dfrac{P}{Q}$ using coprime positive integers $P$ and $Q$. $f(x)$ is defined as the value $P\times Q$.

翻译中…

You 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$.

翻译中…

We 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:

翻译中…
  • 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$.
  • $\gcd(S_1,S_2,\dots,S_N)=1$.
翻译中…

Define the score of a sequence as the product of all its elements.

翻译中…

It can be proved that there are finitely many good sequences. Find the sum, modulo $998244353$, of the scores of all good sequences.

翻译中…

Constraints

翻译中…
  • $2\leq N\leq 1000$
  • $1\leq A_i\leq 1000$ $(1\leq i\leq N-1)$
  • All input values are integers.
翻译中…

Input

翻译中…

The input is given from Standard Input in the following format:

翻译中…

N
A_1 A_2 \dots A_{N-1}

翻译中…

Output

翻译中…

Print the sum, modulo $998244353$, of the scores of all good sequences.

翻译中…

样例

Input #1
6
1 9 2 2 9
Output #1
939634344
For 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$. There are a total of $16$ good sequences, and the sum of the scores of all of them is $939634344$.
Input #2
2
9
Output #2
18
There are $2$ good sequences, both with a score of $9$.
Input #3
25
222 299 229 22 999 922 99 992 22 292 222 229 992 922 22 992 222 222 99 29 92 999 2 29
Output #3
192457116
Do not forget to compute the sum modulo $998244353$.
题目信息
题号
arc192_d
时间限制
2 s
内存限制
1024 MB

题面与样例版权归 AtCoder 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。