We have an N-digit digital counter that increments every second. The counter is cyclic: after it reaches 10^N - 1, it starts once again from zero.
Each digit is shown using the standard seven-segment display. The exact forms of all the digits are shown in the ASCII art below.
+ +---+ +---+ + + +---+
| | | | | |
+ +---+ +---+ +---+ +---+
| | | | |
+ +---+ +---+ + +---+
+---+ +---+ +---+ +---+ +---+
| | | | | | | |
+---+ + +---+ +---+ + +
| | | | | | | |
+---+ + +---+ + +---+
Each line segment that connects two adjacent '+' symbols represents a single lit segment. For example, '1' contains two lit segments, and '9' contains five lit segments.
You are given a String current that contains the current number shown by the counter.
The number of characters in current is equal to the number N of displayed digits.
Return the smallest positive number of seconds after which the counter will have the same total number of lit segments as it does now.
|