import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int s = sc.nextInt();
		int[] list = new int[3];
		for(int i = 3; i > 0; i--) {
			int x = s%10;
			s /= 10;
			list[i-1] = x;
			if(x == 1) {
				list[i-1] = 9;
			}else {
				list[i-1] = 1;
			}
		}
		for(int x : list) {
			System.out.print(x);
		}
	}
} import java.util.Scanner; Scanner java.util public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int s = sc.nextInt();
		int[] list = new int[3];
		for(int i = 3; i > 0; i--) {
			int x = s%10;
			s /= 10;
			list[i-1] = x;
			if(x == 1) {
				list[i-1] = 9;
			}else {
				list[i-1] = 1;
			}
		}
		for(int x : list) {
			System.out.print(x);
		}
	}
} Main public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int s = sc.nextInt();
		int[] list = new int[3];
		for(int i = 3; i > 0; i--) {
			int x = s%10;
			s /= 10;
			list[i-1] = x;
			if(x == 1) {
				list[i-1] = 9;
			}else {
				list[i-1] = 1;
			}
		}
		for(int x : list) {
			System.out.print(x);
		}
	} main {
		Scanner sc = new Scanner(System.in);
		int s = sc.nextInt();
		int[] list = new int[3];
		for(int i = 3; i > 0; i--) {
			int x = s%10;
			s /= 10;
			list[i-1] = x;
			if(x == 1) {
				list[i-1] = 9;
			}else {
				list[i-1] = 1;
			}
		}
		for(int x : list) {
			System.out.print(x);
		}
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int s = sc.nextInt(); s sc.nextInt() sc.nextInt sc int[] list = new int[3]; list new int[3] 3 for(int i = 3; i > 0; i--) {
			int x = s%10;
			s /= 10;
			list[i-1] = x;
			if(x == 1) {
				list[i-1] = 9;
			}else {
				list[i-1] = 1;
			}
		} int i = 3; int i = 3; i 3 i > 0 i 0 i-- i-- i {
			int x = s%10;
			s /= 10;
			list[i-1] = x;
			if(x == 1) {
				list[i-1] = 9;
			}else {
				list[i-1] = 1;
			}
		} {
			int x = s%10;
			s /= 10;
			list[i-1] = x;
			if(x == 1) {
				list[i-1] = 9;
			}else {
				list[i-1] = 1;
			}
		} int x = s%10; x s%10 s 10 s /= 10 s 10 list[i-1] = x list[i-1] list i-1 i 1 x if(x == 1) {
				list[i-1] = 9;
			}else {
				list[i-1] = 1;
			} x == 1 x 1 {
				list[i-1] = 9;
			} list[i-1] = 9 list[i-1] list i-1 i 1 9 {
				list[i-1] = 1;
			} list[i-1] = 1 list[i-1] list i-1 i 1 1 for(int x : list) {
			System.out.print(x);
		} int x list {
			System.out.print(x);
		} {
			System.out.print(x);
		} System.out.print(x) System.out.print System.out System System.out x String[] args args public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int s = sc.nextInt();
		int[] list = new int[3];
		for(int i = 3; i > 0; i--) {
			int x = s%10;
			s /= 10;
			list[i-1] = x;
			if(x == 1) {
				list[i-1] = 9;
			}else {
				list[i-1] = 1;
			}
		}
		for(int x : list) {
			System.out.print(x);
		}
	}
} public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int s = sc.nextInt();
		int[] list = new int[3];
		for(int i = 3; i > 0; i--) {
			int x = s%10;
			s /= 10;
			list[i-1] = x;
			if(x == 1) {
				list[i-1] = 9;
			}else {
				list[i-1] = 1;
			}
		}
		for(int x : list) {
			System.out.print(x);
		}
	}
} Main
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int s = sc.nextInt();
		int[] list = new int[3];
		for(int i = 3; i > 0; i--) {
			int x = s%10;
			s /= 10;
			list[i-1] = x;
			if(x == 1) {
				list[i-1] = 9;
			}else {
				list[i-1] = 1;
			}
		}
		for(int x : list) {
			System.out.print(x);
		}
	}
}
