CF1436F Sum Over Subsets

Description

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 Format

N/A

Output Format

N/A

Explanation/Hint

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.