open Batteries

let id x = x

(* 整数を各桁ごとに分解する
 * 下位桁が先頭で，上位桁が末尾
 *)
let decompose n =
  let rec f n l = if n = 0 then l else f (n / 10) (n mod 10 :: l) in
  List.rev (f n [])

let reconstruct l = List.fold_left (fun n m -> n * 10 + m) 0 (List.rev l)

let sum l = List.fold_left (+) 0 l

let digit_sum n = sum (decompose n)

let rec expt ( * ) e a n =  
  if n = 0 then
    e
  else if n land 1 = 1 then
    a * expt ( * ) e (a * a) (n / 2)
  else
    expt ( * ) e (a * a) (n / 2)

(* n / S(n) <= m / S(m) かどうか *)
let pred n m = n * digit_sum m <= m * digit_sum n

let is_snuke_number n =
  (* リスト内で最も左にある 9 未満の整数に 1 を加える．
   * 存在しない場合は末尾に 1 を付け加える．
   *)
  let rec f l = match l with
      [] -> [1]
    | x :: l -> if x < 9 then (x + 1) :: l else x :: f l in
  let rec loop l =
    if List.for_all (fun n -> n = 9) l then
      pred n (reconstruct l)
    else
      pred n (reconstruct l) && loop (f l) in
  loop (decompose n)

(* n 桁のsnuke数 *)
let snuke_numbers n =
  if n < 4 then
    (1 --^ 1000)
    |> Enum.filter (fun m -> expt ( * ) 1 10 (n - 1) <= m && m < expt ( * ) 1 10 n)
    |> Enum.filter is_snuke_number
    |> List.of_enum
  else
    (1000 --^ 10000)
    |> Enum.map (fun m -> (m + 1) * expt ( * ) 1 10 (n - 4) - 1)
    |> Enum.filter is_snuke_number
    |> List.of_enum

let snuke_numbers =
  (1 -- 15)
  |> Enum.map snuke_numbers
  |> List.of_enum
  |> List.fold_left (@) []
  |> List.sort compare
  |> Array.of_list

let () =
  let k = Scanf.scanf "%d" id in
  for i = 0 to k - 1 do
    Printf.printf "%d\n" snuke_numbers.(i)
  done