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 C++14 (GCC 5.4.1) (judge verdict: Accepted)

#include<iostream>

using namespace std;

int s(long long x){
	int res = 0;
	while(x > 0){
		res += x % 10;
		x /= 10;
	}
	return res;
}

long long next_sunuke(long long x){
	if(x < 10){
		return x;
	}
	long long t = x, k = 10;
	double sunuke1, sunuke2;
	sunuke1 = 1.0 * x / s(x);
	while(k <= x){
		t = t - (t % k) + (k - 1);
		sunuke2 = 1.0 * t / s(t);
		if(sunuke1 > sunuke2){
			x = t;
			sunuke1 = sunuke2;
		}else{
			break;
		}
		k *= 10;
	}
	return x;
}

int main(){
	int k, ans = 0;
	cin >> k;
	long long t = 1;
	for(int i = 1; i <= k; i++){
		cout << t << endl;
		t = next_sunuke(t + 1);
	}
	return 0;
}