You are given an array of
Constraints
Subtask 1 [20%]
Subtask 2 [80%]
No additional constraints.
Input Specification
The first line contains one integer,
The next line contains
Output Specification
Output one line containing one integer, the sum of the values of all subsequences which contain at least two elements, modulo
Sample Input 1
5
3 1 4 1 5
Sample Output 1
64
Explanation for Sample 1
The following are the values of every subsequence containing at least two elements:
Format:
Where
Subsequences with
Total value of all subsequences with at least two elements:
Sample Input 2
10
5 1 29 8 7 10 48 15 33 59
Sample Output 2
30210
Sample Input 3
50
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 1000000000 1000000000
Sample Output 3
119486481
Explanation for Sample 3
Remember to output the answer modulo
Comments