import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);
		StringBuilder sb = new StringBuilder();

		String[] s = sc.next().split("");

		for(int i = 0; i < s.length; i++) {
			sb.append(s[i].equals("1") ? "9" : "1");
		}

		System.out.println(sb);
	}
} import java.util.Scanner; Scanner java.util public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);
		StringBuilder sb = new StringBuilder();

		String[] s = sc.next().split("");

		for(int i = 0; i < s.length; i++) {
			sb.append(s[i].equals("1") ? "9" : "1");
		}

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

		Scanner sc = new Scanner(System.in);
		StringBuilder sb = new StringBuilder();

		String[] s = sc.next().split("");

		for(int i = 0; i < s.length; i++) {
			sb.append(s[i].equals("1") ? "9" : "1");
		}

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

		Scanner sc = new Scanner(System.in);
		StringBuilder sb = new StringBuilder();

		String[] s = sc.next().split("");

		for(int i = 0; i < s.length; i++) {
			sb.append(s[i].equals("1") ? "9" : "1");
		}

		System.out.println(sb);
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) StringBuilder sb = new StringBuilder(); sb new StringBuilder() String[] s = sc.next().split(""); s sc.next().split("") sc.next().split sc.next() sc.next sc "" for(int i = 0; i < s.length; i++) {
			sb.append(s[i].equals("1") ? "9" : "1");
		} int i = 0; int i = 0; i 0 i < s.length i s.length s s.length i++ i++ i {
			sb.append(s[i].equals("1") ? "9" : "1");
		} {
			sb.append(s[i].equals("1") ? "9" : "1");
		} sb.append(s[i].equals("1") ? "9" : "1") sb.append sb s[i].equals("1") ? "9" : "1" s[i].equals("1") s[i].equals s[i] s i "1" "9" "1" System.out.println(sb) System.out.println System.out System System.out sb String[] args args public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);
		StringBuilder sb = new StringBuilder();

		String[] s = sc.next().split("");

		for(int i = 0; i < s.length; i++) {
			sb.append(s[i].equals("1") ? "9" : "1");
		}

		System.out.println(sb);
	}
} public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);
		StringBuilder sb = new StringBuilder();

		String[] s = sc.next().split("");

		for(int i = 0; i < s.length; i++) {
			sb.append(s[i].equals("1") ? "9" : "1");
		}

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

public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);
		StringBuilder sb = new StringBuilder();

		String[] s = sc.next().split("");

		for(int i = 0; i < s.length; i++) {
			sb.append(s[i].equals("1") ? "9" : "1");
		}

		System.out.println(sb);
	}
}