public class Main{ public static void main(String[] args) { int b = Integer.valueOf(args[0]).intValue(); System.out.println(2017-b); } }