import java.util.Scanner;

public class Main {
	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		String s = String.valueOf(n);
		String ans = "";

		for (int i = 1; i <= 3; i++) {
			String cash = s.substring(i - 1, i);
			if (cash.equals("1")) {

				ans += "9";

			} else {

				ans += "1";

			}
		}
		System.out.println(ans);
	}
} import java.util.Scanner; Scanner java.util public class Main {
	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		String s = String.valueOf(n);
		String ans = "";

		for (int i = 1; i <= 3; i++) {
			String cash = s.substring(i - 1, i);
			if (cash.equals("1")) {

				ans += "9";

			} else {

				ans += "1";

			}
		}
		System.out.println(ans);
	}
} Main public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		String s = String.valueOf(n);
		String ans = "";

		for (int i = 1; i <= 3; i++) {
			String cash = s.substring(i - 1, i);
			if (cash.equals("1")) {

				ans += "9";

			} else {

				ans += "1";

			}
		}
		System.out.println(ans);
	} main {

		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		String s = String.valueOf(n);
		String ans = "";

		for (int i = 1; i <= 3; i++) {
			String cash = s.substring(i - 1, i);
			if (cash.equals("1")) {

				ans += "9";

			} else {

				ans += "1";

			}
		}
		System.out.println(ans);
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int n = sc.nextInt(); n sc.nextInt() sc.nextInt sc String s = String.valueOf(n); s String.valueOf(n) String.valueOf String n String ans = ""; ans "" for (int i = 1; i <= 3; i++) {
			String cash = s.substring(i - 1, i);
			if (cash.equals("1")) {

				ans += "9";

			} else {

				ans += "1";

			}
		} int i = 1; int i = 1; i 1 i <= 3 i 3 i++ i++ i {
			String cash = s.substring(i - 1, i);
			if (cash.equals("1")) {

				ans += "9";

			} else {

				ans += "1";

			}
		} {
			String cash = s.substring(i - 1, i);
			if (cash.equals("1")) {

				ans += "9";

			} else {

				ans += "1";

			}
		} String cash = s.substring(i - 1, i); cash s.substring(i - 1, i) s.substring s i - 1 i 1 i if (cash.equals("1")) {

				ans += "9";

			} else {

				ans += "1";

			} cash.equals("1") cash.equals cash "1" {

				ans += "9";

			} ans += "9" ans "9" {

				ans += "1";

			} ans += "1" ans "1" 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 sc = new Scanner(System.in);
		int n = sc.nextInt();
		String s = String.valueOf(n);
		String ans = "";

		for (int i = 1; i <= 3; i++) {
			String cash = s.substring(i - 1, i);
			if (cash.equals("1")) {

				ans += "9";

			} else {

				ans += "1";

			}
		}
		System.out.println(ans);
	}
} public class Main {
	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		String s = String.valueOf(n);
		String ans = "";

		for (int i = 1; i <= 3; i++) {
			String cash = s.substring(i - 1, i);
			if (cash.equals("1")) {

				ans += "9";

			} else {

				ans += "1";

			}
		}
		System.out.println(ans);
	}
} Main
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		String s = String.valueOf(n);
		String ans = "";

		for (int i = 1; i <= 3; i++) {
			String cash = s.substring(i - 1, i);
			if (cash.equals("1")) {

				ans += "9";

			} else {

				ans += "1";

			}
		}
		System.out.println(ans);
	}
}
