Codeforces Round 678 (Div. 2)
F
Sum Over Subsets
Codeforces
2800
原题
← E→
翻译中…

You are given a multiset $S$. Over all pairs of subsets $A$ and $B$, such that:

翻译中…
  • $B \subset A$;
  • $|B| = |A| - 1$;
  • greatest common divisor of all elements in $A$ is equal to one;
翻译中…

find the sum of $\sum_{x \in A}{x} \cdot \sum_{x \in B}{x}$, modulo $998\,244\,353$.

翻译中…

Input

翻译中…

The first line contains one integer $m$ ($1 \le m \le 10^5$): the number of different values in the multiset $S$.

翻译中…

Each of the next $m$ lines contains two integers $a_i$, $freq_i$ ($1 \le a_i \le 10^5, 1 \le freq_i \le 10^9$). Element $a_i$ appears in the multiset $S$ $freq_i$ times. All $a_i$ are different.

翻译中…

Output

翻译中…

Print the required sum, modulo $998\,244\,353$.

翻译中…

Note

翻译中…

A multiset is a set where elements are allowed to coincide. $|X|$ is the cardinality of a set $X$, the number of elements in it.

翻译中…

$A \subset B$: Set $A$ is a subset of a set $B$.

翻译中…

In the first example $B=\{1\}, A=\{1,2\}$ and $B=\{2\}, A=\{1, 2\}$ have a product equal to $1\cdot3 + 2\cdot3=9$. Other pairs of $A$ and $B$ don't satisfy the given constraints.

翻译中…

样例

Input #1
2
1 1
2 1
Output #1
9
InputCopy OutputCopy
Input #2
4
1 1
2 1
3 1
6 1
Output #2
1207
InputCopy OutputCopy
Input #3
1
1 5
Output #3
560
InputCopy OutputCopy
题目信息
题号
1436F
时间限制
1 s
内存限制
256 MB
标签
组合数学
数学
数论

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