N = int(input()) Nl = list(str(N)) N0 = 0 N0l = list(str(N0)) while "7" in Nl or "7" in N0l: N = N-10 Nl = list(str(N)) N0 = N+10 N0l = list(str(N0)) print(N,N0)