A - 10^N+7 Editorial /

Time Limit: 2 sec / Memory Limit: 1024 MB

Score : 100 points

Problem Statement

You are given three non-negative integers, x, y, z. Your task is to find the smallest non-negative integer n with all of the following conditions:

  • n\ {\rm mod}\ 17 = x
  • n\ {\rm mod}\ 107 = y
  • n\ {\rm mod}\ 1000000007(=10^9+7) = z

Constraints

  • 0 \leq x < 17
  • 0 \leq y < 107
  • 0 \leq z < 10^9+7

Input

The input is given from Standard Input in the following format:

x y z

Output

Print the value of n in the statement.


Sample Input 1

15 50 1

Sample Output 1

1000000008

Sample Input 2

0 0 0

Sample Output 2

0

Sample Input 3

3 14 159265358

Sample Output 3

1050159272708