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