def sumOfDigits(n: int) -> int: sod = 0 while True: sod += n % 10 n = n // 10 if n == 0: return sod n = int(input()) while n: sodn = sumOfDigits(n) p = 11 while True: if sodn == sumOfDigits(n * p): print(p) break p += 1 n = int(input())