import java.util.Scanner; class no530{ public static void main(String[] args) { Scanner stdIn=new Scanner(System.in); int y=stdIn.nextInt(); System.out.println(2017-y); } }