AtCoder Grand Contest 038
C
LCMs
AtCoder
⌀ 2327
原题
← BD →
翻译中…

Problem Statement

翻译中…

We have an integer sequence of length $N$: $A_0,A_1,\cdots,A_{N-1}$.

翻译中…

Find the following sum ($\mathrm{lcm}(a, b)$ denotes the least common multiple of $a$ and $b$):

翻译中…
  • $\sum_{i=0}^{N-2} \sum_{j=i+1}^{N-1} \mathrm{lcm}(A_i,A_j)$
翻译中…

Since the answer may be enormous, compute it modulo $998244353$.

翻译中…

Constraints

翻译中…
  • $1 \leq N \leq 200000$
  • $1 \leq A_i \leq 1000000$
  • All values in input are integers.
翻译中…

Input

翻译中…

Input is given from Standard Input in the following format:

翻译中…

N
A_0\ A_1\ \cdots\ A_{N-1}

翻译中…

Output

翻译中…

Print the sum modulo $998244353$.

翻译中…

样例

Input #1
3
2 4 6
Output #1
22
$\mathrm{lcm}(2,4)+\mathrm{lcm}(2,6)+\mathrm{lcm}(4,6)=4+6+12=22$.
Input #2
8
1 2 3 4 6 8 12 12
Output #2
313
Input #3
10
356822 296174 484500 710640 518322 888250 259161 609120 592348 713644
Output #3
353891724
题目信息
题号
agc038_c
时间限制
2 s
内存限制
1024 MB

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