Problem Statement
There are non-negative integers
Find the remainder when
Constraints
, , , , , and are integers.
Input
The input is given from Standard Input in the following format:
Output
Print the remainder when
Sample Input 1
Copy
2 3 5 1 2 4
Sample Output 1
Copy
22
Since
we have
Sample Input 2
Copy
1 1 1000000000 0 0 0
Sample Output 2
Copy
1755647
Since
we have
Sample Input 3
Copy
1000000000000000000 1000000000000000000 1000000000000000000 1000000000000000000 1000000000000000000 1000000000000000000
Sample Output 3
Copy
0
We have
Comments