import sys readline=sys.stdin.readline Y=int(readline()) ans=2017-Y print(ans)