Related: Program my microwave oven and Generate lazy values.
My colleague is so lazy that he doesn't even bother to move his finger when programming the microwave oven. (This is actually true!)
Help him find the microwave input that gives the time closest to what he wants, but where all digits are the same. If two inputs result in the same time difference from the desired time, choose the one with fewer digits. If both have the same number of digits, choose the lesser – so he doesn't have to wait so long.
Input is the integer that a perfectionist would enter, e.g. 430
is 4 minutes and 30 seconds while 100
and 60
each is 1 minute. It will be greater than 0 and will not exceed 9999.
Output must an integer, e.g. 444
is 4 minutes and 44 seconds and 55
is 55 seconds.
Both input and output may only be in simple seconds (no minutes) if the total time is below 1 minute and 40 seconds.
This is code-golf, so your code must be as short as possible.
Test cases:
30 → 33
60 → 55
70 → 111
90 → 88
100 → 55
101 → 66
120 → 77
130 → 88
200 → 99
201 → 222
500 → 444
700 → 666
1000 → 888
1055 → 999
1056 → 1111
1090 → 1111