Problem:
Score : 500 points

Problem Statement

Let S(n) denote the sum of the digits in the decimal notation of n.
For example, S(123) = 1 + 2 + 3 = 6.

We will call an integer n a Snuke number when, for all positive integers m such that m > n, \frac{n}{S(n)} \leq \frac{m}{S(m)} holds.

Given an integer K, list the K smallest Snuke numbers.

Constraints

1 \leq K

The K-th smallest Snuke number is not greater than 10^{15}.

Input

Input is given from Standard Input in the following format:

K

Output

Print K lines. The i-th line should contain the i-th smallest Snuke number.

Sample Input 1

10

Sample Output 1

1
2
3
4
5
6
7
8
9
19

Solution in OCaml (4.10.0) (judge verdict: Wrong Answer)

Scanf.scanf "%d" (fun k ->
    let l = [ 1,  9; 1,  9;  1,  19;  2,  29;  3,  39;  4,  49;  5, 59;
              6, 69; 7, 79;  8,  89;  9,  99; 10, 109; 11, 109; 11, 99 ]
    in

    let proc ten s t acc =
        let rec loop i acc =
            if i > t then acc else
                loop (i + 1) ((i * ten + ten - 1) :: acc)
        in
        loop s acc
    in

    let rec loop ten acc = function
        | [] -> acc
        | (s, t) :: tl ->
                loop (ten * 10) (proc ten s t acc) tl
    in
    let r = Array.of_list (loop 1 [] l) in
    Array.sort compare r;
    for i = 0 to k - 1 do
        Printf.printf "%d\n" r.(i)
    done
)