Hide

Problem F
Sum of Powers

Accepted submissions to this problem will be granted a score of 100

Write a program that, given k and a sequence x=(x1,x2,,xn) of length n, finds the sum of a series of the form

kx1+kx2++kxn=i=1nkxi

For example, if k=2, n=3, and x=(3,4,7), then the sum would be 23+24+27=152.

Input

The first line contains an integer k, where 100k100. The second line contains n, the length of the sequence x, where 1n100. Then n lines follow, the i-th of which contains one integer, xi, where 0xi2000.

Output

Output consists of one line with one integer, the sum of the series.

Sample Input 1 Sample Output 1
2
4
5
3
6
1
106
Sample Input 2 Sample Output 2
1
5
0
5
1231
8
4
5
Sample Input 3 Sample Output 3
10
4
0
1
2
3
1111
Sample Input 4 Sample Output 4
-5
5
2
4
6
8
10
10172525
Sample Input 5 Sample Output 5
-5
5
1
3
5
7
9
-2034505
Hide

Please log in to submit a solution to this problem

Log in