import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String n = sc.next();
		int tmp = 0;
		String answer = "";

		for (int i = 0; i < 3; i++) {
			tmp = Integer.parseInt(n.substring(i, i+1));
			if ("1".equals(String.valueOf(tmp))) {
				answer += "9";
			} else if ("9".equals(String.valueOf(tmp))) {
				answer += "1";
			} else {
				answer += tmp;
			}
		}
		System.out.println(answer);
	}
} 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();
		int tmp = 0;
		String answer = "";

		for (int i = 0; i < 3; i++) {
			tmp = Integer.parseInt(n.substring(i, i+1));
			if ("1".equals(String.valueOf(tmp))) {
				answer += "9";
			} else if ("9".equals(String.valueOf(tmp))) {
				answer += "1";
			} else {
				answer += tmp;
			}
		}
		System.out.println(answer);
	}
} Main public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String n = sc.next();
		int tmp = 0;
		String answer = "";

		for (int i = 0; i < 3; i++) {
			tmp = Integer.parseInt(n.substring(i, i+1));
			if ("1".equals(String.valueOf(tmp))) {
				answer += "9";
			} else if ("9".equals(String.valueOf(tmp))) {
				answer += "1";
			} else {
				answer += tmp;
			}
		}
		System.out.println(answer);
	} main {
		Scanner sc = new Scanner(System.in);
		String n = sc.next();
		int tmp = 0;
		String answer = "";

		for (int i = 0; i < 3; i++) {
			tmp = Integer.parseInt(n.substring(i, i+1));
			if ("1".equals(String.valueOf(tmp))) {
				answer += "9";
			} else if ("9".equals(String.valueOf(tmp))) {
				answer += "1";
			} else {
				answer += tmp;
			}
		}
		System.out.println(answer);
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String n = sc.next(); n sc.next() sc.next sc int tmp = 0; tmp 0 String answer = ""; answer "" for (int i = 0; i < 3; i++) {
			tmp = Integer.parseInt(n.substring(i, i+1));
			if ("1".equals(String.valueOf(tmp))) {
				answer += "9";
			} else if ("9".equals(String.valueOf(tmp))) {
				answer += "1";
			} else {
				answer += tmp;
			}
		} int i = 0; int i = 0; i 0 i < 3 i 3 i++ i++ i {
			tmp = Integer.parseInt(n.substring(i, i+1));
			if ("1".equals(String.valueOf(tmp))) {
				answer += "9";
			} else if ("9".equals(String.valueOf(tmp))) {
				answer += "1";
			} else {
				answer += tmp;
			}
		} {
			tmp = Integer.parseInt(n.substring(i, i+1));
			if ("1".equals(String.valueOf(tmp))) {
				answer += "9";
			} else if ("9".equals(String.valueOf(tmp))) {
				answer += "1";
			} else {
				answer += tmp;
			}
		} tmp = Integer.parseInt(n.substring(i, i+1)) tmp Integer.parseInt(n.substring(i, i+1)) Integer.parseInt Integer n.substring(i, i+1) n.substring n i i+1 i 1 if ("1".equals(String.valueOf(tmp))) {
				answer += "9";
			} else if ("9".equals(String.valueOf(tmp))) {
				answer += "1";
			} else {
				answer += tmp;
			} "1".equals(String.valueOf(tmp)) "1".equals "1" String.valueOf(tmp) String.valueOf String tmp {
				answer += "9";
			} answer += "9" answer "9" if ("9".equals(String.valueOf(tmp))) {
				answer += "1";
			} else {
				answer += tmp;
			} "9".equals(String.valueOf(tmp)) "9".equals "9" String.valueOf(tmp) String.valueOf String tmp {
				answer += "1";
			} answer += "1" answer "1" {
				answer += tmp;
			} answer += tmp answer tmp System.out.println(answer) System.out.println System.out System System.out answer String[] args args public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String n = sc.next();
		int tmp = 0;
		String answer = "";

		for (int i = 0; i < 3; i++) {
			tmp = Integer.parseInt(n.substring(i, i+1));
			if ("1".equals(String.valueOf(tmp))) {
				answer += "9";
			} else if ("9".equals(String.valueOf(tmp))) {
				answer += "1";
			} else {
				answer += tmp;
			}
		}
		System.out.println(answer);
	}
} public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String n = sc.next();
		int tmp = 0;
		String answer = "";

		for (int i = 0; i < 3; i++) {
			tmp = Integer.parseInt(n.substring(i, i+1));
			if ("1".equals(String.valueOf(tmp))) {
				answer += "9";
			} else if ("9".equals(String.valueOf(tmp))) {
				answer += "1";
			} else {
				answer += tmp;
			}
		}
		System.out.println(answer);
	}
} Main
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String n = sc.next();
		int tmp = 0;
		String answer = "";

		for (int i = 0; i < 3; i++) {
			tmp = Integer.parseInt(n.substring(i, i+1));
			if ("1".equals(String.valueOf(tmp))) {
				answer += "9";
			} else if ("9".equals(String.valueOf(tmp))) {
				answer += "1";
			} else {
				answer += tmp;
			}
		}
		System.out.println(answer);
	}
}
