Write a program that, given $k$ and a sequence $x = (x_1, x_2, \dots , x_n)$ of
length $n$, finds the sum
of a series of the form
\[
k^{x_1}+k^{x_2}+\cdots +k^{x_n} = \sum _{i=1}^n k^{x_i}
\]
For example, if $k =
2$, $n=3$, and
$x = (3, 4, 7)$, then the
sum would be $2^3 + 2^4 + 2^7 =
152$.
Input
The first line contains an integer $k$, where $-100 \leq k \leq 100$. The second
line contains $n$, the
length of the sequence $x$, where $1 \leq n \leq 100$. Then $n$ lines follow, the $i$-th of which contains one integer,
$x_i$, where $0 \leq x_i \leq 2\, 000$.
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
|