## A Math Contest P2 - Subsequence Sum

View as PDF

Points: 5
Time limit: 1.0s
Memory limit: 256M

Author:
Problem type

You are given an array of integers, . Find the sum of all of its subsequence sums modulo .

#### 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 .