# coding: utf-8 # Your code here! y = int(input()) print(2017 - y)