| 시간 제한 | 메모리 제한 | 제출 | 정답 | 맞힌 사람 | 정답 비율 |
|---|---|---|---|---|---|
| 1 초 | 2048 MB | 42 | 33 | 28 | 75.676% |
Long ago, in the fairy kingdom of Time, there lived a kind wizard named Nikolay. He adored the magical number 239, which brought him luck and joy every time he saw it on the magical digital clock of the kingdom located at the main square.
This wonderful clock displayed time using four digits: two for the hours and two for the minutes. If the number of hours or minutes was less than 10ドル,ドル a 0ドル$ was placed in the front.
Nikolay can enchant time so that there will be $H$ hours in each day, numbered from 0ドル$ to $H - 1,ドル and $M$ minutes in each hour, numbered from 0ドル$ to $M - 1$. For this spell, Nikolay can select any numbers $H$ and $M$ between 10ドル$ and 100ドル,ドル inclusive.
The time shown by the clock is lucky only when the digits resemble the cherished combination 239:
X2:39, where the first digit X can take any value from 0 to 9.2X:39, where the digit X can take the value 0, 2, or 3 (because 0 does not hinder the perception of the magical number).23:X9, where the digit X can take the value 0, 3, or 9.23:9X, where the digit X can take any value from 0 to 9.One day, Nikolay faced the question: "Given $H$ and $M,ドル how many minutes in a full day will the clock show a lucky number?" Help Nikolay find this number.
The first line of input contains two integers $H$ and $M$ separated by a space: the number of hours in a day and the number of minutes in an hour (10ドル \le H, M \le 100$).
Output the number of minutes in a full day when the clock will show a lucky number.
24 60
6