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