package main

import (
	"io"
	"os"

	"fmt"

	"strconv"
)

func S(n int) int {
	ns := strconv.Itoa(n)

	sum := 0
	for _, c := range string(ns) {
		i, _ := strconv.Atoi(string(c))
		sum += i
	}

	return sum
}

func Solve(in io.Reader, out io.Writer) {
	var ks string
	fmt.Fscan(in, &ks)
	k, _ := strconv.Atoi(ks)

	max := 0
	for i := 1; i <= k; i++ {
		x := S(i)
		if x > max {
			max = x
			fmt.Fprintln(out, i)
		} else {
			k++
		}
	}
}

func main() {
	Solve(os.Stdin, os.Stdout)
}
