Let
Given and , print .
Input Specification
The first line will contain two integers, .
The second line will contain integers, .
Output Specification
Print .
Subtasks
Subtask 1 [20%]
Subtask 2 [30%]
Subtask 3 [50%]
No further constraints.
Sample Input 1
2 5
1 1
Sample Output 1
5
Sample Input 2 (not in pretests)
6 90000
4 2 29 5 1 10
Sample Output 2
408918679
Comments