#!/mnt/c/Users/moiki/bash/env/bin/python
# N,M = map(int, input().split())

def S(n):
    ans = 0
    while n != 0:
        ans += n % 10 
        n //= 10
    return ans


snum = [0]
for i in range(1, 100000):
    snum.append( i/S(i))
    # print("{i:4d} : ".format(i=i), S(i))
    # print("{i:4d}  S(i): {S}:  i/S(i): {Si}".format(i=i, S=S(i), Si=i/S(i) ))

for i in range(1, 100000):
    if snum[i] == min(snum[i:]):
        print("{i:4d}  S(i): {S}:  i/S(i): {Si}".format(i=i, S=S(i), Si=i/S(i) ))
