n = int(input()) ANS = [] while n > 0: n, r = divmod(n, 7) ANS.append(r) if len(ANS) == 0: print(0) else: ANS.reverse() print(''.join(map(str, ANS)))