import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner scan = new Scanner(System.in); int Y = scan.nextInt(); scan.close(); int ans = 2017 - Y; System.out.println(ans); } }