GCDDCG
시간 제한1초메모리 제한2048 MB
각 i에 대해 두 카드 집합의 최대공약수가 모두 i가 되도록 서로소인 공집합 아닌 두 집합을 만드는 경우의 수를 세고, 그 수에 i를 곱한 값을 모두 더해 998244353으로 나눈 나머지를 구한다.
문제
You are playing the Greatest Common Divisor Deck-Building Card Game (GCDDCG). There are cards (numbered from to ). Card has the value of , which is an integer between and (inclusive).
The game consists of rounds (numbered from to ). Within each round, you need to build two non-empty decks, deck and deck . A card cannot be inside both decks, and it is allowed to not use all cards. In round , the greatest common divisor (GCD) of the card values in each deck must equal .
Your creativity point during round is the product of and the number of ways to build two valid decks. Two ways are considered different if one of the decks contains different cards.
Find the sum of creativity points across all rounds. Since the sum can be very large, calculate the sum modulo .
입력
The first line consists of an integer ().
The second line consists of integers ().
출력
Output a single integer representing the sum of creativity points across all rounds modulo .