Submit | All submissions | Best solutions | Back to list |
MOZMTF - Mozahid the forgetful |
Mozahid is a forgetful programmer. He is so forgetful that sometimes he forget at night the problem he solved that morning :(
One morning he collect a number which consist of 11 digits and do not have any leading zeroes (Example 12345678910 is correct but 01234567891 is not). He was trying to collect it from the previous year and after a long one year try he managed to collect it and it is sure that probability to find it again is near to 0%.
At the night he found that instead of writing 11 digits of the number he wrote 10 digits and unfortunately missed 1 digit. But he was sure that all the 10 digits are correct and the relative order of the digits in the number was not changed. As he is forgetful, he forgot what was the number. But this time fortunately he know the total sum of all 11 digits of the original number and he is also sure that the number was maximum among all possible way of restoring the number.
As Mozahid is frustrated about why he can’t easily remember anything, he is not interested to restore the number at the moment. Can you do it for him?
Input
First line of the input consist an integer n, having 10 digits.
In the second line you will be given an integer m, which is the sum of all 11 digits of the original number.
Output
Output a single line which is the original number.
Constraints
n is an integer of 10 digits, it is not guaranteed that this number doesn’t have leading zeros.
m >= sum of all 10 digits of n.
It is guaranteed that all inputs are valid and there is a solution of the problem.
For better understanding see the sample input output.
Example
Input: 1234567890 50 Output: 51234567890
Added by: | Mozahid |
Date: | 2019-02-14 |
Time limit: | 1s |
Source limit: | 50000B |
Memory limit: | 1536MB |
Cluster: | Cube (Intel G860) |
Languages: | All |