Fives
Medium
Execution time limit is 0.1 seconds
Runtime memory usage limit is 64 megabytes
Given two integers, N
and K
, your task is to find the smallest number greater than N
that has at least K
occurrences of the digit '5' in its decimal representation.
Input
The first line of the input contains two integers, N
and K
, where (1 ≤ N ≤ 10^{15}, 1 ≤ K ≤ 15)
.
Output
Print the smallest number that meets the criteria.
Examples
Input #1
Answer #1
Input #2
Answer #2
Input #3
Answer #3
Input #4
Answer #4
Submissions 255
Acceptance rate 13%