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