import java.util.Scanner; public class Main{ static final Scanner s=new Scanner(System.in); public static void main(String[]__){ System.out.println(2017-s.nextInt()); } }