import java.util.*; import java.io.PrintWriter; public class Main{ public static void main(String args[] ) throws Exception { Scanner sc = new Scanner(System.in); PrintWriter out = new PrintWriter(System.out); int Y = sc.nextInt(); System.out.println(2017 - Y); } }