import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner in = new Scanner(System.in); String ans = ""; String S = in.next(); int a = Integer.parseInt(S); System.out.println(2017-a); } }