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