Time limit
2s
Memory limit
128 MB
Minseung wants to assign one positive integer label to each of (N) students, where (1 \le N \le 1,000,000). No label may contain the decimal digit (L), where (0 \le L \le 9).\n\nAmong all positive integers whose decimal representation does not contain (L), take the smallest (N) values as the labels. Find the largest label among them.
The first line contains two integers (N) and (L), separated by a space.
Print the largest label that will be used.
When (N = 10) and (L = 1), the 10 smallest usable labels are (2, 3, 4, 5, 6, 7, 8, 9, 20, 22). Therefore, the largest label is (22).