import java.util.Scanner;

 class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
//		int n = sc.nextInt();
		String num = sc.nextInt()+"";
		String ans = "";
		for (int i = 0; i < num.length(); i++)
			ans = ans + (num.charAt(i) == '1' ? 9 : 1);
		System.out.println(ans);
	}
} import java.util.Scanner; Scanner java.util class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
//		int n = sc.nextInt();
		String num = sc.nextInt()+"";
		String ans = "";
		for (int i = 0; i < num.length(); i++)
			ans = ans + (num.charAt(i) == '1' ? 9 : 1);
		System.out.println(ans);
	}
} Main public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
//		int n = sc.nextInt();
		String num = sc.nextInt()+"";
		String ans = "";
		for (int i = 0; i < num.length(); i++)
			ans = ans + (num.charAt(i) == '1' ? 9 : 1);
		System.out.println(ans);
	} main {
		Scanner sc = new Scanner(System.in);
//		int n = sc.nextInt();
		String num = sc.nextInt()+"";
		String ans = "";
		for (int i = 0; i < num.length(); i++)
			ans = ans + (num.charAt(i) == '1' ? 9 : 1);
		System.out.println(ans);
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String num = sc.nextInt()+""; num sc.nextInt()+"" sc.nextInt() sc.nextInt sc "" String ans = ""; ans "" for (int i = 0; i < num.length(); i++)
			ans = ans + (num.charAt(i) == '1' ? 9 : 1); int i = 0; int i = 0; i 0 i < num.length() i num.length() num.length num i++ i++ i ans = ans + (num.charAt(i) == '1' ? 9 : 1); ans = ans + (num.charAt(i) == '1' ? 9 : 1) ans ans + (num.charAt(i) == '1' ? 9 : 1) ans (num.charAt(i) == '1' ? 9 : 1) num.charAt(i) == '1' num.charAt(i) num.charAt num i '1' 9 1 System.out.println(ans) System.out.println System.out System System.out ans String[] args args
import java.util.Scanner;

 class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
//		int n = sc.nextInt();
		String num = sc.nextInt()+"";
		String ans = "";
		for (int i = 0; i < num.length(); i++)
			ans = ans + (num.charAt(i) == '1' ? 9 : 1);
		System.out.println(ans);
	}
}