

Time Limit: 2 sec / Memory Limit: 1024 MiB
問題文
あるバス停からは毎時 X 分にバスが出ます。 例えば、X=10 の場合、0 時 10 分、1 時 10 分、\dots、23 時 10 分にバスが出ます。 他の時刻にはバスは出ません。
いま、H 時 M 分 (M\neq X) です。次のバスは何分後に出ますか?
制約
- 0\leq H \leq 23
- 0\leq X,M \leq 59
- X\neq M
- 入力は全て整数
入力
入力は以下の形式で標準入力から与えられる。
X H M
出力
答えを整数として出力せよ。
入力例 1
30 14 10
出力例 1
20
現在の時刻は 14 時 10 分であり、次にバスが出るのは 14 時 30 分なので、今から 20 分後です。
入力例 2
12 23 30
出力例 2
42
現在の時刻は 23 時 30 分であり、次にバスが出るのは翌日の 0 時 12 分なので、今から 42 分後です。
入力例 3
1 17 34
出力例 3
27
Problem Statement
There is a bus stop where buses depart at X minutes past each hour. For example, if X=10, buses depart at 0:10, 1:10, \ldots, and 23:10. No buses depart at any other time.
It is currently M minutes past H (M\neq X). How many minutes are left before the next bus departs?
Constraints
- 0\leq H \leq 23
- 0\leq X,M \leq 59
- X\neq M
- All input values are integers.
Input
The input is given from Standard Input in the following format:
X H M
Output
Print the answer as an integer.
Sample Input 1
30 14 10
Sample Output 1
20
It is 14:10 now. The next bus departs at 14:30, which is 20 minutes from now.
Sample Input 2
12 23 30
Sample Output 2
42
It is 23:30 now. The next bus departs at 0:12 on the next day, which is 42 minutes from now.
Sample Input 3
1 17 34
Sample Output 3
27