loj#P3478. 「ROIR 2021 Day 2」好数
「ROIR 2021 Day 2」好数
Description
Translated from Chinese version of ROIR 2021 Day2 T2 Числа on this website.
We call those numbers satisfying that numbers on all digits are the same as Beautiful Numbers of type .
Additionally, we define Beautiful Numbers of type as those satisfying any of the following conditions:
- Is a beautiful number of type I.
- Assume this is a number with digits and no prefix zeros, then the numbers on digits are the same.
Now you are given a value and your task is to find the first Beautiful Number of type which satisfies .
Input Format
The first line consists of a single integer .
The next line consists of a single integer .
Output Format
Output a single integer representing your answer.
700
0
777
700
1
700
Constraints
For all test data, it is guaranteed that ,。
Subtask # | Additional Constraints | Score |
---|---|---|
, | ||
No Additional Constraints |