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 Java8 (OpenJDK 1.8.0) (judge verdict: Wrong Answer)

import java.math.BigInteger;
import java.util.*;


public class Main {
	
	
	private void doit(){
		Scanner sc = new Scanner(System.in);
		while(sc.hasNext()){
			long k = sc.nextLong();
			
//			double min = Double.MAX_VALUE;
			ArrayList<Long> list = new ArrayList<>();
//			for(int i = 100001; i >= 1; i--){
//				long sum = 0;
//				int now = i;
//				while(now > 0){
//					sum += now % 10;
//					now /= 10;
//				}
//				double res = (double)i / sum;
//				debug(res, sum, i);
//				if(res <= min){
//					min = res;
//					list.add((long)i);
//				}
//			}
//			debug(list);
			
//			long now = 0;
//			long inc = 1;
//			while(true){
//				if(now > 1000000000000000000L) break;
//				for(int i = 0; i < 9; i++){
//					if(Long.MAX_VALUE - inc <= now ){
//						break;
//					}
//					now += inc;
//					list.add(now);
//				}
//				inc *= 10;
//				
//			}
//			StringBuilder sb = new StringBuilder();
//			long len = Math.min(k, list.size());
//			for(int i = 0; i < len; i++){
//				sb.append(list.get(i)+"\n");
//			}
//			System.out.print(sb.toString());
			
			String incstr = "";
			int now = 0;
			for(int i = 0; i < k; i++){
				System.out.println(now + 1 + incstr);
				now++;
				
				if(incstr.length() >= 2){
					if(now >= 18){
						now = 0;
						incstr = incstr + "9";
					}
				}
				else{
					now %= 9;
					if(now == 0){
						incstr = incstr + "9";
					}
					
				}
			}
//			debug(list.get(list.size()-1), list.size());
		}
	}
	
	private long calc(long n, long m, long l){
		long sum = 1;
		for(long i = n; i > m; i--){
			sum *= i;
		}
		for(long i = 2; i <= l; i++){
			sum /= i;
		}
		return sum;
	}

	private void debug(Object... o) {
		System.out.println("debug = " + Arrays.deepToString(o));
	}

	public static void main(String[] args) {
		new Main().doit();
	}

}