和的平方之和 / Sum of Square of Sum
该比赛已结束,您无法在比赛模式下递交该题目。您可以点击“在题库中打开”以普通模式查看和递交本题。
Statement
There are balls numbered to . Ball has an integer written on it.
For a way of choosing some balls from the balls, define the score of that choice as the square of the sum of the numbers written on the chosen balls.
Find the sum, modulo , of the scores of all ways of choosing balls from the balls.
Input
The input is given from Standard Input in the following format:
Output
Output the answer.
Constraints
- All input values are integers.
3 2
1 10 100
22422
There are three ways of choosing two balls from three balls: choosing balls gives a score of , choosing balls gives a score of , and choosing balls gives a score of .
The answer is the sum of these, .
5 2
10 10 20 20 20
10600
Multiple balls may have the same number written on them.
2 1
998244353 998244353
0
Find the sum modulo .