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