N = int(input()) Nl = list(str(N)) while "7" in Nl: N = N-100000 Nl = list(str(N)) print(N)