from sys import stdin import math import re import queue import numpy as np from numpy.linalg import matrix_rank input = stdin.readline # MOD = 1000000007 MOD = 998244353 INF = 122337203685477580 def heron(a, b, c): d = (a + b + c) / 2 return math.sqrt(d * (d - a) * (d - b) * (d - c)) def solve(): n = int(input().rstrip()) print(2017 -n) return if __name__ == '__main__': solve()