You are given numbers n and k. You are allowed to insert + between the digits of the number n. This way you obtain an expression. The goal is to insert + between the digits of n so that the value of the obtained expression is as close as possible to k (by close we mean that the absolute difference is as low as possible)
InputTwo integers n and k (1 <= n, k <= 10^9).
OutputWrite the value of the expression obtained by adding + signs among the digits of n.
Input: 19967 1000 Output: 1004 Explanation: We insert the + signs between the digits of n the following way: 1 + 996 + 7 = 1004, and that is the number closest to 1000.