A Math Contest P2 - Subsequence Sum
View as PDFYou are given an array of  integers, 
. Find the sum of all of its subsequence sums modulo 
.
Constraints
Input Specification
The first line contains an integer, .
The next line contains  space-separated integers, 
.
Output Specification
Output the sum of all subsequence sums modulo .
Sample Input
3
1 2 3
Sample Output
24
Explanation for Sample
The subsequence sums are
The sum of all subsequence sums is .
Comments