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