시간 제한메모리 제한제출정답맞힌 사람정답 비율
1 초 (추가 시간 없음) 1024 MB333100.000%

문제

Given are $n$ prime numbers $1 < p_1 < p_2 < \ldots < p_n < 10^{18}$ with $p_1 \le 100$. We say that the number $x$ is good if $x$ is divisible by at least one $p_i$.

Take all good numbers $a_1, a_2, \cdots, a_m$ in $[0, p_1 \cdot p_2 \cdot \ldots \cdot p_n]$ and sort them in order ($a_1 < a_2 < \ldots < a_m$). Your task is to calculate $\sum_{i=1}^{m-1} (a_{i+1} - a_i)^2$. As the sum could be very large, you should output it modulo $998\,244\,353$.

입력

The first line of the input contains a single integer $n$ ($1 \le n \le 10^5$).

The next line of the input contains $n$ integers $p_1, p_2, \ldots, p_n$ ($1 < p_1 < p_2 < \ldots < p_n < 10^{18}$). It is guaranteed that $2 \le p_1 < 100$ and each $p_i$ ($1 \le i \le n$) is a prime number.

출력

Output a single line with a single integer, indicating the answer modulo $998\,244\,353$.

예제 입력 1

2
2 5

예제 출력 1

18

예제 입력 2

3
5 7 233

예제 출력 2

31275

노트

In the first example, the list of good numbers is:

  • $a_1 = 0$
  • $a_2 = 2$
  • $a_3 = 4$
  • $a_4 = 5$
  • $a_5 = 6$
  • $a_6 = 8$
  • $a_7 = 10$

Thus, the answer is $(2-0)^2+(4-2)^2+(5-4)^2+(6-5)^2+(8-6)^2+(10-8)^2=18$.