#P6012. [P5087] 数学 加强版
[P5087] 数学 加强版
Description
Xiao Ben is obsessed with multiplication. His favorite thing to do is: from a multiset with elements, choose numbers, and use the product of these numbers as the score of this combination.
Xiao Ben wants to try all such combinations, and then compute the sum of the scores of all combinations. However, he still needs to crush us rookies in a mock contest, so he has to hand this task over to you.
As a “not so kind” problem setter, you also need to take the answer modulo .
Input Format
The first line contains two positive integers .
The second line contains positive integers , representing the elements in the multiset.
Output Format
Output one line with one integer representing the answer.
3 3
1 1 1
1
4 3
1 1 1 2
7
10 7
11 45 14 19 19 8 10 8 17 23
693404716
Hint
[Explanation for Sample 2]
There are four ways to choose: one is , and the other three are all . The sum of the scores is .
[Constraints]
For of the testdata, , 。
Translated by ChatGPT 5
京公网安备 11011102002149号