N = int(input()) if N > 1000000: N2 = N // 5 print(("285714" * N2)[N-1])