N = int(input()) print(2017-N)