import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String N = sc.nextLine();
		sc.close();
		String a [] = new String [3];
		a[0] = N.substring(0,1);
		a[1] = N.substring(1,2);
		a[2] = N.substring(2,3);

		for(int i = 0; i < 3; i++) {
			if(a[i].equals("1")) {
				a[i] = "9";
			}else if(a[i].equals("9")) {
				a[i] = "1";
			}
		}

		System.out.println(a[0]+a[1]+a[2]);

	}

} import java.util.Scanner; Scanner java.util public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String N = sc.nextLine();
		sc.close();
		String a [] = new String [3];
		a[0] = N.substring(0,1);
		a[1] = N.substring(1,2);
		a[2] = N.substring(2,3);

		for(int i = 0; i < 3; i++) {
			if(a[i].equals("1")) {
				a[i] = "9";
			}else if(a[i].equals("9")) {
				a[i] = "1";
			}
		}

		System.out.println(a[0]+a[1]+a[2]);

	}

} Main public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String N = sc.nextLine();
		sc.close();
		String a [] = new String [3];
		a[0] = N.substring(0,1);
		a[1] = N.substring(1,2);
		a[2] = N.substring(2,3);

		for(int i = 0; i < 3; i++) {
			if(a[i].equals("1")) {
				a[i] = "9";
			}else if(a[i].equals("9")) {
				a[i] = "1";
			}
		}

		System.out.println(a[0]+a[1]+a[2]);

	} main {
		Scanner sc = new Scanner(System.in);
		String N = sc.nextLine();
		sc.close();
		String a [] = new String [3];
		a[0] = N.substring(0,1);
		a[1] = N.substring(1,2);
		a[2] = N.substring(2,3);

		for(int i = 0; i < 3; i++) {
			if(a[i].equals("1")) {
				a[i] = "9";
			}else if(a[i].equals("9")) {
				a[i] = "1";
			}
		}

		System.out.println(a[0]+a[1]+a[2]);

	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String N = sc.nextLine(); N sc.nextLine() sc.nextLine sc sc.close() sc.close sc String a [] = new String [3]; a new String [3] 3 a[0] = N.substring(0,1) a[0] a 0 N.substring(0,1) N.substring N 0 1 a[1] = N.substring(1,2) a[1] a 1 N.substring(1,2) N.substring N 1 2 a[2] = N.substring(2,3) a[2] a 2 N.substring(2,3) N.substring N 2 3 for(int i = 0; i < 3; i++) {
			if(a[i].equals("1")) {
				a[i] = "9";
			}else if(a[i].equals("9")) {
				a[i] = "1";
			}
		} int i = 0; int i = 0; i 0 i < 3 i 3 i++ i++ i {
			if(a[i].equals("1")) {
				a[i] = "9";
			}else if(a[i].equals("9")) {
				a[i] = "1";
			}
		} {
			if(a[i].equals("1")) {
				a[i] = "9";
			}else if(a[i].equals("9")) {
				a[i] = "1";
			}
		} if(a[i].equals("1")) {
				a[i] = "9";
			}else if(a[i].equals("9")) {
				a[i] = "1";
			} a[i].equals("1") a[i].equals a[i] a i "1" {
				a[i] = "9";
			} a[i] = "9" a[i] a i "9" if(a[i].equals("9")) {
				a[i] = "1";
			} a[i].equals("9") a[i].equals a[i] a i "9" {
				a[i] = "1";
			} a[i] = "1" a[i] a i "1" System.out.println(a[0]+a[1]+a[2]) System.out.println System.out System System.out a[0]+a[1]+a[2] a[0]+a[1]+a[2] a[0] a 0 a[1] a 1 a[2] a 2 String[] args args public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String N = sc.nextLine();
		sc.close();
		String a [] = new String [3];
		a[0] = N.substring(0,1);
		a[1] = N.substring(1,2);
		a[2] = N.substring(2,3);

		for(int i = 0; i < 3; i++) {
			if(a[i].equals("1")) {
				a[i] = "9";
			}else if(a[i].equals("9")) {
				a[i] = "1";
			}
		}

		System.out.println(a[0]+a[1]+a[2]);

	}

} public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String N = sc.nextLine();
		sc.close();
		String a [] = new String [3];
		a[0] = N.substring(0,1);
		a[1] = N.substring(1,2);
		a[2] = N.substring(2,3);

		for(int i = 0; i < 3; i++) {
			if(a[i].equals("1")) {
				a[i] = "9";
			}else if(a[i].equals("9")) {
				a[i] = "1";
			}
		}

		System.out.println(a[0]+a[1]+a[2]);

	}

} Main
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String N = sc.nextLine();
		sc.close();
		String a [] = new String [3];
		a[0] = N.substring(0,1);
		a[1] = N.substring(1,2);
		a[2] = N.substring(2,3);

		for(int i = 0; i < 3; i++) {
			if(a[i].equals("1")) {
				a[i] = "9";
			}else if(a[i].equals("9")) {
				a[i] = "1";
			}
		}

		System.out.println(a[0]+a[1]+a[2]);

	}

}
