|시간 제한||메모리 제한||제출||정답||맞은 사람||정답 비율|
|1 초||128 MB||2||0||0||0.000%|
The operation # is defined for any two positive integers.
If x and y are positive integers, then
(x#y) = sum_of_digits_in_x_decimal_notation × greatest_digit_in_y_decimal_notation + least_digit_in_y_decimal_notation
For example, (9#30) = 9×3+0 = 27, but (30#9) = 3×9+9 = 36.
Let us say that this problem's expression is such an expression which is either the single variable a (whose value is positive integer), or it can be written in the form (this problem's expression # this problem's expression).
For example, the following expressions are this problem's expressions:
You are to write a program, which for the given value of a determines what is the least possible number of operations # with which this problem's expression with given value K (K - positive integer) can be written.
From the keyboard two positive integer values are input - the value of integer variable a (1 ≤ a ≤ 999999999) and the value of the expression K (1 ≤ K ≤ 999999999).
On the screen the least necessary number of operations # must be written. If for the given value of a it is impossible to obtain K as a value of this problem's expression , then the word 'NEVAR' must be written.