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# (Mono 4.6.2.0) (judge verdict: Accepted)

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
using System.Threading.Tasks;
using Atcoder.AtCoderBeginnerContest101.Questions;
using Atcoder.AtCoderBeginnerContest101.Extensions;

namespace Atcoder.AtCoderBeginnerContest101
{
    class Program
    {
        static void Main(string[] args)
        {
            IAtCoderQuestion question = new QuestionD();    // 問題に合わせて書き換え
            var answer = question.Solve(Console.In);
            //Console.WriteLine(answer);
        }
    }
}

namespace Atcoder.AtCoderBeginnerContest101.Questions
{
    // ここにQuestionクラスをコピペ
    public class QuestionD : AtCoderQuestionBase
    {
        public override string Solve(TextReader inputStream)
        {
            var k = inputStream.ReadInt();
            long previousSunuke = 0;
            double previousIPerSi = 1;

            for (int i = 0; i < k; i++)
            {
                long diffCandidate;
                long nextSunukeCandidate;
                long nextSi;
                long nextDiffCandidate;
                double iPerSi;
                
                diffCandidate = GetDiff(previousIPerSi);

                while (true)
                {
                    nextSunukeCandidate = previousSunuke + diffCandidate;
                    nextSi = S(nextSunukeCandidate);
                    iPerSi = (double)nextSunukeCandidate / nextSi;
                    nextDiffCandidate = GetDiff(iPerSi);

                    if (diffCandidate >= nextDiffCandidate)
                    {
                        break;
                    }
                    diffCandidate = nextDiffCandidate;
                }

                Console.WriteLine(nextSunukeCandidate);
                previousSunuke = nextSunukeCandidate;
                previousIPerSi = iPerSi;
            }

            return string.Empty;
        }

        long S(long n)
        {
            long sum = 0;
            while (n != 0)
            {
                sum += n % 10;
                n /= 10;
            }

            return sum;
        }

        long GetDiff(double iPerSi)
        {
            var power = (long)Math.Ceiling(Math.Log10(iPerSi) - double.Epsilon);
            return (long)Math.Pow(10L, power);
        }
    }


    #region Base Classes

    public interface IAtCoderQuestion
    {
        string Solve(string input);
        string Solve(TextReader inputStream);
    }

    public abstract class AtCoderQuestionBase : IAtCoderQuestion
    {
        public string Solve(string input)
        {
            var stream = new MemoryStream(Encoding.Unicode.GetBytes(input));
            var reader = new StreamReader(stream, Encoding.Unicode);

            return Solve(reader);
        }

        public abstract string Solve(TextReader inputStream);
    }

    #endregion
}

#region Extensions

namespace Atcoder.AtCoderBeginnerContest101.Extensions
{
    internal static class TextReaderExtensions
    {
        internal static int ReadInt(this TextReader reader) => int.Parse(ReadString(reader));
        internal static long ReadLong(this TextReader reader) => long.Parse(ReadString(reader));
        internal static double ReadDouble(this TextReader reader) => double.Parse(ReadString(reader));
        internal static string ReadString(this TextReader reader) => reader.ReadLine();

        internal static int[] ReadIntArray(this TextReader reader, char separator = ' ') => ReadStringArray(reader, separator).Select(int.Parse).ToArray();
        internal static long[] ReadLongArray(this TextReader reader, char separator = ' ') => ReadStringArray(reader, separator).Select(long.Parse).ToArray();
        internal static double[] ReadDoubleArray(this TextReader reader, char separator = ' ') => ReadStringArray(reader, separator).Select(double.Parse).ToArray();
        internal static string[] ReadStringArray(this TextReader reader, char separator = ' ') => reader.ReadLine().Split(separator);
    }
}

#endregion