N = int(input()) N_list = [] while True: if N // 7 < 7: N_list.append(N % 7) N_list.append(N // 7) break else: N_list.append(N % 7) N = N // 7 for i in range(len(N_list)-1,-1,-1): print(N_list[i],end="") print()