import java.util.*; import java.util.Scanner; import java.io.BufferedReader; import java.io.InputStreamReader; public class Main { public static void main(String[] args) throws Exception { Scanner s = new Scanner(System.in); int a = s.nextInt(); System.out.println(2017 - a); BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); String line = br.readLine(); } }