niz
An array of integers A[i] (i > 1) is defined in the following way: an element A[k] ( k > 1) is the smallest number greater than A[k-1] such that the sum of its digits is equal to the sum of the digits of the number 4* A[k-1] .
You need to write a program that calculates the N th number in this array based on the given first element A[1] .
InputIn one line of standard input there are two numbers seperated with a single space: A[1] (1 <= A[1] <= 100) and N (1 <= N <= 10000).
OutputThe standard output should only contain a single integer A[N] , the Nth number of the defined sequence.
Input:
7 4Output:
79Explanation:
Elements of the array are as follows: 7, 19, 49, 79... and the 4th element is solution.
Submit solution
Coming laterThe grading service will be connected in a later migration step. You can inspect the task and your previous results now.