{"raw_statement":[{"iden":"problem statement","content":"Define the **score** of a sequence of positive integers $B = (B_1, B_2, \\dots, B_k)$ as $\\displaystyle \\sum_{i=1}^{k-1} \\gcd(B_i, B_{i+1})$.  \nGiven a sequence of positive integers $A = (A_1, A_2, \\dots, A_N)$, solve the following problem for $m = 1, 2, \\dots, N$.\n\n*   There are $2^m - 1$ non-empty subsequences of the sequence $(A_1, A_2, \\dots, A_m)$. Find the sum of the scores of all those subsequences, modulo $998244353$. Two subsequences are distinguished if they are taken from different positions in the sequence, even if they coincide as sequences."},{"iden":"constraints","content":"*   $1 \\leq N \\leq 5 \\times 10^5$\n*   $1 \\leq A_i \\leq 10^5$\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$"},{"iden":"sample input 1","content":"3\n9 6 4"},{"iden":"sample output 1","content":"0\n3\n11\n\nConsider the case $m = 3$. Here are the non-empty subsequences of $(A_1, A_2, A_3) = (9, 6, 4)$ and their scores.\n\n*   $(9)$: Score is $0$.\n*   $(6)$: Score is $0$.\n*   $(4)$: Score is $0$.\n*   $(9, 6)$: Score is $\\gcd(9, 6) = 3$.\n*   $(9, 4)$: Score is $\\gcd(9, 4) = 1$.\n*   $(6, 4)$: Score is $\\gcd(6, 4) = 2$.\n*   $(9, 6, 4)$: Score is $\\gcd(9, 6) + \\gcd(6, 4) = 3 + 2 = 5$.\n\nTherefore, the answer for $m = 3$ is $0 + 0 + 0 + 3 + 1 + 2 + 5 = 11$."},{"iden":"sample input 2","content":"5\n3 8 12 6 9"},{"iden":"sample output 2","content":"0\n1\n13\n57\n155"},{"iden":"sample input 3","content":"10\n47718 21994 74148 76721 98917 73766 29598 59035 69293 29127"},{"iden":"sample output 3","content":"0\n2\n14\n35\n97\n372\n866\n1859\n4273\n43287"}],"translated_statement":null,"sample_group":[],"show_order":["default"],"formal_statement":null,"simple_statement":null,"has_page_source":true}