Just Another Number Theory Problem

아직 제출이 없습니다시간 제한1초메모리 제한1024 MB

문제

Given are nn prime numbers 1<p_1<p_2<<p_n<10181 < p\_1 < p\_2 < \ldots < p\_n < 10^{18} with p_1100p\_1 \le 100. We say that the number xx is good if xx is divisible by at least one p_ip\_i.

Take all good numbers a_1,a_2,,a_ma\_1, a\_2, \cdots, a\_m in \[0,p_1p_2p_n]\[0, p\_1 \cdot p\_2 \cdot \ldots \cdot p\_n] and sort them in order (a_1<a_2<<a_ma\_1 < a\_2 < \ldots < a\_m). Your task is to calculate _i=1m1(a_i+1a_i)2\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,353998\\,244\\,353.

입력

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

The next line of the input contains nn integers p_1,p_2,,p_np\_1, p\_2, \ldots, p\_n (1<p_1<p_2<<p_n<10181 < p\_1 < p\_2 < \ldots < p\_n < 10^{18}). It is guaranteed that 2p_1<1002 \le p\_1 < 100 and each p_ip\_i (1in1 \le i \le n) is a prime number.

출력

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

힌트

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

  • a_1=0a\_1 = 0
  • a_2=2a\_2 = 2
  • a_3=4a\_3 = 4
  • a_4=5a\_4 = 5
  • a_5=6a\_5 = 6
  • a_6=8a\_6 = 8
  • a_7=10a\_7 = 10

Thus, the answer is (20)2+(42)2+(54)2+(65)2+(86)2+(108)2=18(2-0)^2+(4-2)^2+(5-4)^2+(6-5)^2+(8-6)^2+(10-8)^2=18.