P6723 [COCI 2015/2016 #5] ZAMKA
Description
Given three integers $L, D, X$, you need to find two integers $N, M$ such that:
- $N$ is the smallest integer that satisfies $L \le N \le D$ and the sum of the digits of $N$ is $X$.
- $M$ is the largest integer that satisfies $L \le M \le D$ and the sum of the digits of $M$ is $X$.
It is guaranteed that $N$ and $M$ exist.
Input Format
The input has three lines.
The first line contains an integer $L$, the second line contains an integer $D$, and the third line contains an integer $X$.
Output Format
Output two lines.
The first line contains an integer $N$, and the second line contains an integer $M$.
Explanation/Hint
#### Constraints
For $100\%$ of the testdata, $1 \le L \le D \le 10^4$, $1 \le X \le 36$.
#### Notes
**This problem is translated from [COCI2015-2016](https://hsin.hr/coci/archive/2015_2016/) [CONTEST #5](https://hsin.hr/coci/archive/2015_2016/contest5_tasks.pdf) *T1 ZAMKA***。
Translated by ChatGPT 5