307927: CF1436F. Sum Over Subsets
Memory Limit:256 MB
Time Limit:1 S
Judge Style:Text Compare
Creator:
Submit:0
Solved:0
Description
Sum Over Subsets
题意翻译
你有一个可重集$S$,要求他的两个子集$A,B$满足$:$ $1$°$B$是$A$的子集 $2$°$B$的元素个数等于$A$的元素个数减一 $3$°$A$的所有元素$gcd$为$1$ 若A,B满足则计算 $\sum_{x∈A} * \sum_{x∈B}$ mod 998244353 然后对所有满足条件的$A,B$累加求和 *注意:值相等的不同的元素算不同集合,可参考样例3*题目描述
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 $ .输入输出格式
输入格式
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.
输出格式
Print the required sum, modulo $ 998\,244\,353 $ .
输入输出样例
输入样例 #1
2
1 1
2 1
输出样例 #1
9
输入样例 #2
4
1 1
2 1
3 1
6 1
输出样例 #2
1207
输入样例 #3
1
1 5
输出样例 #3
560