import sys input=lambda: sys.stdin.readline().rstrip() y=int(input()) print(2017-y)