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