import java.util.Scanner;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		
		String n = sc.next();
		String nArr[] = n.split("",0);
		
		for (int i = 0; i < 3; i++) {
			if (nArr[i].equals("1")) {
				nArr[i] = "9";
			} else {
				nArr[i] = "1";
			}
		}
		
		System.out.println(nArr[0] + nArr[1] + nArr[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.next();
		String nArr[] = n.split("",0);
		
		for (int i = 0; i < 3; i++) {
			if (nArr[i].equals("1")) {
				nArr[i] = "9";
			} else {
				nArr[i] = "1";
			}
		}
		
		System.out.println(nArr[0] + nArr[1] + nArr[2]);
	}
} Main public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		
		String n = sc.next();
		String nArr[] = n.split("",0);
		
		for (int i = 0; i < 3; i++) {
			if (nArr[i].equals("1")) {
				nArr[i] = "9";
			} else {
				nArr[i] = "1";
			}
		}
		
		System.out.println(nArr[0] + nArr[1] + nArr[2]);
	} main {
		Scanner sc = new Scanner(System.in);
		
		String n = sc.next();
		String nArr[] = n.split("",0);
		
		for (int i = 0; i < 3; i++) {
			if (nArr[i].equals("1")) {
				nArr[i] = "9";
			} else {
				nArr[i] = "1";
			}
		}
		
		System.out.println(nArr[0] + nArr[1] + nArr[2]);
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String n = sc.next(); n sc.next() sc.next sc String nArr[] = n.split("",0); nArr n.split("",0) n.split n "" 0 for (int i = 0; i < 3; i++) {
			if (nArr[i].equals("1")) {
				nArr[i] = "9";
			} else {
				nArr[i] = "1";
			}
		} int i = 0; int i = 0; i 0 i < 3 i 3 i++ i++ i {
			if (nArr[i].equals("1")) {
				nArr[i] = "9";
			} else {
				nArr[i] = "1";
			}
		} {
			if (nArr[i].equals("1")) {
				nArr[i] = "9";
			} else {
				nArr[i] = "1";
			}
		} if (nArr[i].equals("1")) {
				nArr[i] = "9";
			} else {
				nArr[i] = "1";
			} nArr[i].equals("1") nArr[i].equals nArr[i] nArr i "1" {
				nArr[i] = "9";
			} nArr[i] = "9" nArr[i] nArr i "9" {
				nArr[i] = "1";
			} nArr[i] = "1" nArr[i] nArr i "1" System.out.println(nArr[0] + nArr[1] + nArr[2]) System.out.println System.out System System.out nArr[0] + nArr[1] + nArr[2] nArr[0] + nArr[1] + nArr[2] nArr[0] nArr 0 nArr[1] nArr 1 nArr[2] nArr 2 String[] args args public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		
		String n = sc.next();
		String nArr[] = n.split("",0);
		
		for (int i = 0; i < 3; i++) {
			if (nArr[i].equals("1")) {
				nArr[i] = "9";
			} else {
				nArr[i] = "1";
			}
		}
		
		System.out.println(nArr[0] + nArr[1] + nArr[2]);
	}
} public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		
		String n = sc.next();
		String nArr[] = n.split("",0);
		
		for (int i = 0; i < 3; i++) {
			if (nArr[i].equals("1")) {
				nArr[i] = "9";
			} else {
				nArr[i] = "1";
			}
		}
		
		System.out.println(nArr[0] + nArr[1] + nArr[2]);
	}
} Main
import java.util.Scanner;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		
		String n = sc.next();
		String nArr[] = n.split("",0);
		
		for (int i = 0; i < 3; i++) {
			if (nArr[i].equals("1")) {
				nArr[i] = "9";
			} else {
				nArr[i] = "1";
			}
		}
		
		System.out.println(nArr[0] + nArr[1] + nArr[2]);
	}
}