Author: | A. Karabanov | Time limit: | 1 sec | |
Input file: | Standard input | Memory limit: | 256 Mb | |
Output file: | Standard output |
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 data contain three natural numbers: a, b and n.
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.
2≤a+b≤99
1971≤n≤3000
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.
No. | Standard input | Standard output |
---|---|---|
1 |
|
|
2 |
|
|