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 Java (OpenJDK 11.0.6) (judge verdict: Accepted)

import java.util.Scanner;

/**
 * https://atcoder.jp/contests/abc101/submissions/15815216 を参考に作成したソースコード
 */
public class Main {

	/** 10 */
	private static final int TEN = 10;

	public static void main(String[] args) {
		try (Scanner scanner = new Scanner(System.in)) {
			int k = scanner.nextInt();
			long a = 0, b = 1;
			for (int i = 0; i < k; i++) {
				if (((9 == (a / b) % TEN)) && (f(a + b) > f(a + TEN * b))) {
					b *= TEN;
				}
				a += b;
				System.out.println(a);
			}
		}
	}

	/**
	 * n/s(n)を計算する
	 * 
	 * @param n
	 * @return n/s(n)
	 */
	private static double f(long n) {
		long sum = 0, now = n;
		while (now > 0) {
			sum += now % TEN;
			now /= TEN;
		}
		return ((double) n) / sum;
	}
}