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 Go (1.6) (judge verdict: Wrong Answer)

package main
import (
  "fmt"
  "math"
  "os"
)
func main() {
  var k,n int64
  fmt.Scan(&k)
  for i:=int64(0);i<9;i++ {
    if i == k { os.Exit(0) }
    fmt.Println(i+1)
  }
  n = 19
  for i:=k-9;i>0;i-- {
    fmt.Println(f(n))
    n = f(n+1)
  }
}
func f(n int64) int64 {
  var u int = int(math.Log10(float64(n)))+1
  var e int64 = 10
  var m int64 = 10*int64(float64(n)/10.0+1)-1
  for d:=1;d<u;d++ {
    e *= 10
    x := e*int64(float64(n)/float64(e)+1)-1
    if m > x { m = x }
  }
  return m
}