Problem B. Back from the future

Author:A. Karabanov   Time limit:1 sec
Input file:Standard input   Memory limit:256 Mb
Output file:Standard output  

Statement

Kolya Gerasimov was born on January 1st, 1970. After visiting his strange neighbor's apartment on April 11th, 1982, he found a time machine and travels exactly 100 years into the future (that is, he goes to April 11th, 2082).

After living in the future for exactly a years, Kolya uses the same machine to go back to the past, where he lives normally, collecting precious archive data for future historians. After exactly b more years after his return, Kolya makes the final travel for exactly 100 years into the future. Then he lives in the future without aging due to amazing achievements of future medicine.

How many full years did Kolya Gerasimov live at January 1st of year n?

Input format

Input data contain three natural numbers: a, b and n.

Output format

Output data must contain a single integer — full years lived by Kolya on January 1st of the given year. If at the given date Kolya was not present in that moment of time, output  − 1.

Constraints

2 ≤ a + b ≤ 99

1971 ≤ n ≤ 3000

Note on samples

In both samples Kolya lived in the future for 12 years, got back, and after 27 years went to the beautiful faraway again. Time line for the life of Kolya is given on a picture. For January 1st, 2088 he lived 18 full years. However, on January 1st 1988 he was in the future.

Sample tests

No. Standard input Standard output
1
12 27 2088
18
2
12 27 1988
-1

3.910s 3.396s 15