N = int(input()) ns = [] while N: N, r = divmod(N, 7) ns.append(r) ns.reverse() if not ns: ns = [0] print(''.join(map(str, ns)))