import java.util.Scanner;
public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		char[] arr = String.valueOf(n).toCharArray();
		n= arr[0]=='9'? n-800 : n+800;
		n= arr[1]=='9'? n-80 : n+80;
		n= arr[2]=='9'? n-8 : n+8;
		System.out.println(n);		
	}
} import java.util.Scanner; Scanner java.util public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		char[] arr = String.valueOf(n).toCharArray();
		n= arr[0]=='9'? n-800 : n+800;
		n= arr[1]=='9'? n-80 : n+80;
		n= arr[2]=='9'? n-8 : n+8;
		System.out.println(n);		
	}
} Main public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		char[] arr = String.valueOf(n).toCharArray();
		n= arr[0]=='9'? n-800 : n+800;
		n= arr[1]=='9'? n-80 : n+80;
		n= arr[2]=='9'? n-8 : n+8;
		System.out.println(n);		
	} main {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		char[] arr = String.valueOf(n).toCharArray();
		n= arr[0]=='9'? n-800 : n+800;
		n= arr[1]=='9'? n-80 : n+80;
		n= arr[2]=='9'? n-8 : n+8;
		System.out.println(n);		
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int n = sc.nextInt(); n sc.nextInt() sc.nextInt sc char[] arr = String.valueOf(n).toCharArray(); arr String.valueOf(n).toCharArray() String.valueOf(n).toCharArray String.valueOf(n) String.valueOf String n n= arr[0]=='9'? n-800 : n+800 n arr[0]=='9'? n-800 : n+800 arr[0]=='9' arr[0] arr 0 '9' n-800 n 800 n+800 n 800 n= arr[1]=='9'? n-80 : n+80 n arr[1]=='9'? n-80 : n+80 arr[1]=='9' arr[1] arr 1 '9' n-80 n 80 n+80 n 80 n= arr[2]=='9'? n-8 : n+8 n arr[2]=='9'? n-8 : n+8 arr[2]=='9' arr[2] arr 2 '9' n-8 n 8 n+8 n 8 System.out.println(n) System.out.println System.out System System.out n String[] args args public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		char[] arr = String.valueOf(n).toCharArray();
		n= arr[0]=='9'? n-800 : n+800;
		n= arr[1]=='9'? n-80 : n+80;
		n= arr[2]=='9'? n-8 : n+8;
		System.out.println(n);		
	}
} public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		char[] arr = String.valueOf(n).toCharArray();
		n= arr[0]=='9'? n-800 : n+800;
		n= arr[1]=='9'? n-80 : n+80;
		n= arr[2]=='9'? n-8 : n+8;
		System.out.println(n);		
	}
} Main
import java.util.Scanner;
public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		char[] arr = String.valueOf(n).toCharArray();
		n= arr[0]=='9'? n-800 : n+800;
		n= arr[1]=='9'? n-80 : n+80;
		n= arr[2]=='9'? n-8 : n+8;
		System.out.println(n);		
	}
}