N = int(input()) a = [] while True: q,r = divmod(N,7) a.append(r) if q == 0: break N = q print(''.join([str(x) for x in reversed(a)]))