from itertools import islice
def snuke(n):
    return n / sum(int(c) for c in str(n))

def snukes():
    for i in range(1, 10):
        yield i
    i = 19
    while True:
        if snuke(i) < snuke(i + 10):
            yield i
        i += 10

if __name__ == "__main__":
    n = int(input())
    print(list(islice(snukes(), n))[n - 1])
