Marichka's Password
Limits: 2 sec., 256 MiB
This statement was translated automatically from Ukrainian.
Once upon a time, Marichka decided to come up with a new password for herself. Since Marichka’s imagination was not very good, she decided that the password would be a single integer from the range \([l, r]\). She asked Zenyk to help her choose the best password.
Zenyk decided that the smaller the number, the better, because a large number would be hard for Marichka to remember. But it’s not that simple — Marichka’s math skills are also not very good, so she compares numbers as strings. Marichka believes that of two numbers, the smaller one is the one whose string representation is lexicographically smaller.
Help Zenyk choose the best password for Marichka.
A string \(s\) is considered lexicographically smaller than a string \(t\) if there exists such an index \(i\) that \(s_1 = t_1\), \(s_2 = t_2\), …, \(s_{i-1} = t_{i-1}\) and \(s_i < t_i\), or if \(s\) is a prefix of \(t\).
Input
The single line contains two integers \(l\) and \(r\) — the bounds of the range from which Marichka wants to choose her password.
Output
In the single line, print a single number — the lexicographically minimum new password for Marichka.
Constraints
\(1 \le l \le r \le 10^9\).
Samples
| Input (stdin) | Output (stdout) |
|---|---|
| 4 77 | 10 |
Submit a solution
| Element Type | Created | Who | Problem | Compiler | Result | Time (sec.) | Memory (MiB) | # | Actions |
|---|
| Element Type | Created | Who | Problem | Compiler | Result | Time (sec.) | Memory (MiB) | # | Actions |
|---|