{"raw_statement":[{"iden":"statement","content":"Karen is getting ready for a new school day!\n\n<center>![image](https://espresso.codeforces.com/8a2b710021d55bf4b4ee879bfa15914bf89c5da3.png)</center>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.\n\nWhat is the minimum number of minutes she should sleep, such that, when she wakes up, the time is a palindrome?\n\nRemember 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_."},{"iden":"input","content":"The first and only line of input contains a single string in the format _hh:mm_ (00 ≤  _hh_  ≤ 23, 00 ≤  _mm_  ≤ 59)."},{"iden":"output","content":"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."},{"iden":"examples","content":"Input\n\n05:39\n\nOutput\n\n11\n\nInput\n\n13:31\n\nOutput\n\n0\n\nInput\n\n23:59\n\nOutput\n\n1"},{"iden":"note","content":"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.\n\nIn the second test case, Karen can wake up immediately, as the current time, _13:31_, is already a palindrome.\n\nIn 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."}],"translated_statement":[{"iden":"statement","content":"Karen 正在为新的一天做准备！\n\n当前时间是 _hh:mm_，采用 24 小时制。正如你所知，Karen 喜欢 _回文数_，她认为在时间是回文时醒来是好运的象征。\n\n她最少需要睡多少分钟，才能在醒来时时间是一个回文？\n\n记住，回文是一个正读和反读都相同的字符串。例如，_05:39_ 不是回文，因为 _05:39_ 反过来是 _93:50_。而 _05:50_ 是回文，因为 _05:50_ 反过来仍然是 _05:50_。\n\n输入的第一行且唯一一行包含一个格式为 _hh:mm_ 的字符串（#cf_span[00 ≤ ] _hh_ #cf_span[ ≤ 23]，#cf_span[00 ≤ ] _mm_ #cf_span[ ≤ 59]）。\n\n请输出一个单独的整数，表示她最少需要睡的分钟数，使得醒来时的时间是一个回文。\n\n在第一个测试用例中，Karen 最少需要睡 #cf_span[11] 分钟。她可以在 _05:50_ 醒来，此时时间是回文。\n\n在第二个测试用例中，Karen 可以立即醒来，因为当前时间 _13:31_ 已经是回文。\n\n在第三个测试用例中，Karen 最少需要睡 #cf_span[1] 分钟。她可以在 _00:00_ 醒来，此时时间是回文。"},{"iden":"input","content":"输入的第一行且唯一一行包含一个格式为 _hh:mm_ 的字符串（#cf_span[00 ≤ ] _hh_ #cf_span[ ≤ 23]，#cf_span[00 ≤ ] _mm_ #cf_span[ ≤ 59]）。"},{"iden":"output","content":"请输出一个单独的整数，表示她最少需要睡的分钟数，使得醒来时的时间是一个回文。"},{"iden":"examples","content":"输入05:39输出11输入13:31输出0输入23:59输出1"},{"iden":"note","content":"在第一个测试用例中，Karen 最少需要睡 #cf_span[11] 分钟。她可以在 _05:50_ 醒来，此时时间是回文。在第二个测试用例中，Karen 可以立即醒来，因为当前时间 _13:31_ 已经是回文。在第三个测试用例中，Karen 最少需要睡 #cf_span[1] 分钟。她可以在 _00:00_ 醒来，此时时间是回文。"}],"sample_group":[],"show_order":[],"formal_statement":"**Definitions**  \nLet $ t = \\text{hh}:\\text{mm} $ be the current time in 24-hour format, where $ \\text{hh} \\in \\{0, 1, \\dots, 23\\} $, $ \\text{mm} \\in \\{0, 1, \\dots, 59\\} $.  \nLet $ T(m) $ denote the time $ m $ minutes after $ t $, represented as a 4-digit string $ \\text{HHMM} $, with leading zeros (i.e., $ \\text{HH} \\in \\{00, \\dots, 23\\} $, $ \\text{MM} \\in \\{00, \\dots, 59\\} $).\n\n**Constraints**  \n1. $ 0 \\leq \\text{hh} \\leq 23 $  \n2. $ 0 \\leq \\text{mm} \\leq 59 $  \n3. $ T(m) $ must be a valid time: $ \\text{HH} \\in [0, 23] $, $ \\text{MM} \\in [0, 59] $\n\n**Objective**  \nFind the minimum non-negative integer $ m $ such that $ T(m) $ is a palindrome, i.e., the string $ \\text{HHMM} $ satisfies:  \n$$\n\\text{HHMM}[0] = \\text{HHMM}[3] \\quad \\text{and} \\quad \\text{HHMM}[1] = \\text{HHMM}[2]\n$$","simple_statement":null,"has_page_source":false}