Codeforces Round 419 (Div. 2)
A
Karen and Morning
Codeforces
1000
原题
←B →
翻译中…

Karen is getting ready for a new school day!

翻译中…

image

翻译中…

It is currently hh:mm, given in a 24-hour format. As you know, Karen loves palindromes, and she believes that it is good luck to wake up when the time is a palindrome.

翻译中…

What is the minimum number of minutes she should sleep, such that, when she wakes up, the time is a palindrome?

翻译中…

Remember that a palindrome is a string that reads the same forwards and backwards. For instance, 05:39 is not a palindrome, because 05:39 backwards is 93:50. On the other hand, 05:50 is a palindrome, because 05:50 backwards is 05:50.

翻译中…

Input

翻译中…

The first and only line of input contains a single string in the format hh:mm ($00 ≤$ hh $≤ 23$, $00 ≤$ mm $≤ 59$).

翻译中…

Output

翻译中…

Output a single integer on a line by itself, the minimum number of minutes she should sleep, such that, when she wakes up, the time is a palindrome.

翻译中…

Note

翻译中…

In the first test case, the minimum number of minutes Karen should sleep for is $11$. She can wake up at 05:50, when the time is a palindrome.

翻译中…

In the second test case, Karen can wake up immediately, as the current time, 13:31, is already a palindrome.

翻译中…

In the third test case, the minimum number of minutes Karen should sleep for is $1$ minute. She can wake up at 00:00, when the time is a palindrome.

翻译中…

样例

Input #1
05:39
Output #1
11
InputCopy OutputCopy
Input #2
13:31
Output #2
0
InputCopy OutputCopy
Input #3
23:59
Output #3
1
InputCopy OutputCopy
题目信息
题号
816A
时间限制
2 s
内存限制
512 MB
标签
暴力
模拟

题面与样例版权归 Codeforces 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。