
import java.util.ArrayList;
import java.util.Scanner;
public class Main {
	public static void main(String[] args){
		Scanner scan = new Scanner(System.in);

		int n = scan.nextInt();
		int ans = 0;
		int b = 1;

		ArrayList<Integer> list = new ArrayList();
		while (n > 0) {
		    list.add(n % 10);
		    n /= 10;
		}

		for (int i = 0; i < 3; i++){
			if (list.get(i) == 9){
				ans += 1 * b;
			}else if (list.get(i) == 1){
				ans += 9 * b;
			}
			b *= 10;
		}
		System.out.println(ans);
	}
} import java.util.ArrayList; ArrayList java.util import java.util.Scanner; Scanner java.util public class Main {
	public static void main(String[] args){
		Scanner scan = new Scanner(System.in);

		int n = scan.nextInt();
		int ans = 0;
		int b = 1;

		ArrayList<Integer> list = new ArrayList();
		while (n > 0) {
		    list.add(n % 10);
		    n /= 10;
		}

		for (int i = 0; i < 3; i++){
			if (list.get(i) == 9){
				ans += 1 * b;
			}else if (list.get(i) == 1){
				ans += 9 * b;
			}
			b *= 10;
		}
		System.out.println(ans);
	}
} Main public static void main(String[] args){
		Scanner scan = new Scanner(System.in);

		int n = scan.nextInt();
		int ans = 0;
		int b = 1;

		ArrayList<Integer> list = new ArrayList();
		while (n > 0) {
		    list.add(n % 10);
		    n /= 10;
		}

		for (int i = 0; i < 3; i++){
			if (list.get(i) == 9){
				ans += 1 * b;
			}else if (list.get(i) == 1){
				ans += 9 * b;
			}
			b *= 10;
		}
		System.out.println(ans);
	} main {
		Scanner scan = new Scanner(System.in);

		int n = scan.nextInt();
		int ans = 0;
		int b = 1;

		ArrayList<Integer> list = new ArrayList();
		while (n > 0) {
		    list.add(n % 10);
		    n /= 10;
		}

		for (int i = 0; i < 3; i++){
			if (list.get(i) == 9){
				ans += 1 * b;
			}else if (list.get(i) == 1){
				ans += 9 * b;
			}
			b *= 10;
		}
		System.out.println(ans);
	} Scanner scan = new Scanner(System.in); scan new Scanner(System.in) int n = scan.nextInt(); n scan.nextInt() scan.nextInt scan int ans = 0; ans 0 int b = 1; b 1 ArrayList<Integer> list = new ArrayList(); list new ArrayList() while (n > 0) {
		    list.add(n % 10);
		    n /= 10;
		} n > 0 n 0 {
		    list.add(n % 10);
		    n /= 10;
		} list.add(n % 10) list.add list n % 10 n 10 n /= 10 n 10 for (int i = 0; i < 3; i++){
			if (list.get(i) == 9){
				ans += 1 * b;
			}else if (list.get(i) == 1){
				ans += 9 * b;
			}
			b *= 10;
		} int i = 0; int i = 0; i 0 i < 3 i 3 i++ i++ i {
			if (list.get(i) == 9){
				ans += 1 * b;
			}else if (list.get(i) == 1){
				ans += 9 * b;
			}
			b *= 10;
		} {
			if (list.get(i) == 9){
				ans += 1 * b;
			}else if (list.get(i) == 1){
				ans += 9 * b;
			}
			b *= 10;
		} if (list.get(i) == 9){
				ans += 1 * b;
			}else if (list.get(i) == 1){
				ans += 9 * b;
			} list.get(i) == 9 list.get(i) list.get list i 9 {
				ans += 1 * b;
			} ans += 1 * b ans 1 * b 1 b if (list.get(i) == 1){
				ans += 9 * b;
			} list.get(i) == 1 list.get(i) list.get list i 1 {
				ans += 9 * b;
			} ans += 9 * b ans 9 * b 9 b b *= 10 b 10 System.out.println(ans) System.out.println System.out System System.out ans String[] args args public class Main {
	public static void main(String[] args){
		Scanner scan = new Scanner(System.in);

		int n = scan.nextInt();
		int ans = 0;
		int b = 1;

		ArrayList<Integer> list = new ArrayList();
		while (n > 0) {
		    list.add(n % 10);
		    n /= 10;
		}

		for (int i = 0; i < 3; i++){
			if (list.get(i) == 9){
				ans += 1 * b;
			}else if (list.get(i) == 1){
				ans += 9 * b;
			}
			b *= 10;
		}
		System.out.println(ans);
	}
} public class Main {
	public static void main(String[] args){
		Scanner scan = new Scanner(System.in);

		int n = scan.nextInt();
		int ans = 0;
		int b = 1;

		ArrayList<Integer> list = new ArrayList();
		while (n > 0) {
		    list.add(n % 10);
		    n /= 10;
		}

		for (int i = 0; i < 3; i++){
			if (list.get(i) == 9){
				ans += 1 * b;
			}else if (list.get(i) == 1){
				ans += 9 * b;
			}
			b *= 10;
		}
		System.out.println(ans);
	}
} Main

import java.util.ArrayList;
import java.util.Scanner;
public class Main {
	public static void main(String[] args){
		Scanner scan = new Scanner(System.in);

		int n = scan.nextInt();
		int ans = 0;
		int b = 1;

		ArrayList<Integer> list = new ArrayList();
		while (n > 0) {
		    list.add(n % 10);
		    n /= 10;
		}

		for (int i = 0; i < 3; i++){
			if (list.get(i) == 9){
				ans += 1 * b;
			}else if (list.get(i) == 1){
				ans += 9 * b;
			}
			b *= 10;
		}
		System.out.println(ans);
	}
}