Y = int(input()) def solve(Y): return 2017 - Y solve print(solve(Y))