#P9390. 金盏花
金盏花
Problem Description
There is a 12-digit decimal number . You only know that the number formed by its last 6 digits is .
You are also given an integer . Among all possible , you need to find the minimum value of .
Note that , , and have no leading zeros (that is, the most significant digit is not ). Also, must have exactly 12 digits and must have exactly 6 digits.
Input Format
The first line contains two integers .
Output Format
The first line contains one integer, the minimum value of .
987654 123456123456
135802
428571 714285
99999714286
Hint
Sample #1 Explanation
Let . The minimum value of can be .
Sample #2 Explanation
Let . The minimum value of can be .
Constraints
For all testdata: , .
| Subtask ID | Special Constraint | Score | |
|---|---|---|---|
| None | |||

Translated by ChatGPT 5