#coding: utf-8 S = int(input()) print(2017-S)