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