A function has been described as follows:
for all , with , and .
Can you determine modulo ?
Constraints
Input Specification
The first and only line of input will contain , , , and space-separated.
Output Specification
Output an integer in the range , the value of modulo .
Sample Input 1
5 6 7 8
Sample Output 1
12
Explanation for Sample Output 1
The value of for is:
, , , , , , ,
Sample Input 2
3 1 2 8
Sample Output 2
1000000005
Comments