N = int(input()) if N > 100000: N //= 10000 print(("285714" * N)[N-1])