#P9708. [KMOI R1] 集合 First
[KMOI R1] 集合 First
Problem Description
There is a set .
Define the alternating sum as follows:
- Sort the elements in set from large to small, obtaining ( is the number of elements in the set). Then $G(B)=\sum\limits_{i=1}^{cnt}\Big((-1)^{i+1}\times b_i\Big)$.
For example, .
In particular, .
Now, given the set , Xiaoxie wants to know: for any subset of , compute the total sum of .
Because Xiaoxie is too weak, please help. Take the answer modulo .
Input Format
A positive integer , representing the given set .
Output Format
A positive integer , representing the total sum of over any subset of .
The answer is taken modulo .
2
4
1000
476463243
1919810
193840227
Hint
Explanation for Sample
.
.
.
.
Therefore, .
Constraints
This problem uses bundled subtask testdata.
| Subtask ID | Test Points | Score | |
|---|---|---|---|
For of the testdata: .
Postscript
$$\color{orange}{Xiaoxie: Don't hit me, I will never study sets with size greater than\ 30\ again next time.}$$Translated by ChatGPT 5