n = int(input()) li = [] while n >= 7: li.append(n % 7) n = n // 7 li.append(n % 7) a = "" for i in li: a = str(i) + a print(a)