Ben is playing around with some tower blocks!
Each of his
Ben built his tower and is very proud of it, but is now wondering how powerful it is. As everyone knows, a single tower block's power is equal to its label.
However, in a tower consisting of multiple blocks, the power grows very quickly. In a tower of
Ben really wants to know the power of his tower. However, knowing his number might be way too big, he will be happy if you can tell him the power modulo
Constraints
Subtask 1 [1/15]
Subtask 2 [14/15]
No additional constraints.
Input Specification
The first line will contain
The next line will contain
Output Specification
Output the power of Ben's tower, mod
Sample Input 1
3 5
2 3 2
Sample Output 1
2
Explanation for Sample Output 1
The power of Ben's tower is
Note that you do not need to get the correct output on this case to pass the first subtask.
Sample Input 2
3 17
3 5 7
Sample Output 2
12
Sample Input 3
12 35929738
62525611 69201951 54844075 40933790 64603110 102648769 67604167 54424854 69048209 51968609 55767140 95916210
Sample Output 3
9996111
Comments
case 61 :/