import java.util.Scanner;

class Main {
	public static void main(String args[]) {
		StringBuilder sb = new StringBuilder();
		Scanner sc = new Scanner(System.in);
		char[] s = sc.next().toCharArray();
		for (int i = 0; i < s.length; i++) {
			if (s[i] == '1') {
				sb.append("9");
			} else if (s[i] == '9') {
				sb.append("1");
			} else {
				sb.append(s[i]);
			}
		}
		System.out.println(sb);
	}
} import java.util.Scanner; Scanner java.util class Main {
	public static void main(String args[]) {
		StringBuilder sb = new StringBuilder();
		Scanner sc = new Scanner(System.in);
		char[] s = sc.next().toCharArray();
		for (int i = 0; i < s.length; i++) {
			if (s[i] == '1') {
				sb.append("9");
			} else if (s[i] == '9') {
				sb.append("1");
			} else {
				sb.append(s[i]);
			}
		}
		System.out.println(sb);
	}
} Main public static void main(String args[]) {
		StringBuilder sb = new StringBuilder();
		Scanner sc = new Scanner(System.in);
		char[] s = sc.next().toCharArray();
		for (int i = 0; i < s.length; i++) {
			if (s[i] == '1') {
				sb.append("9");
			} else if (s[i] == '9') {
				sb.append("1");
			} else {
				sb.append(s[i]);
			}
		}
		System.out.println(sb);
	} main {
		StringBuilder sb = new StringBuilder();
		Scanner sc = new Scanner(System.in);
		char[] s = sc.next().toCharArray();
		for (int i = 0; i < s.length; i++) {
			if (s[i] == '1') {
				sb.append("9");
			} else if (s[i] == '9') {
				sb.append("1");
			} else {
				sb.append(s[i]);
			}
		}
		System.out.println(sb);
	} StringBuilder sb = new StringBuilder(); sb new StringBuilder() Scanner sc = new Scanner(System.in); sc new Scanner(System.in) char[] s = sc.next().toCharArray(); s sc.next().toCharArray() sc.next().toCharArray sc.next() sc.next sc for (int i = 0; i < s.length; i++) {
			if (s[i] == '1') {
				sb.append("9");
			} else if (s[i] == '9') {
				sb.append("1");
			} else {
				sb.append(s[i]);
			}
		} int i = 0; int i = 0; i 0 i < s.length i s.length s s.length i++ i++ i {
			if (s[i] == '1') {
				sb.append("9");
			} else if (s[i] == '9') {
				sb.append("1");
			} else {
				sb.append(s[i]);
			}
		} {
			if (s[i] == '1') {
				sb.append("9");
			} else if (s[i] == '9') {
				sb.append("1");
			} else {
				sb.append(s[i]);
			}
		} if (s[i] == '1') {
				sb.append("9");
			} else if (s[i] == '9') {
				sb.append("1");
			} else {
				sb.append(s[i]);
			} s[i] == '1' s[i] s i '1' {
				sb.append("9");
			} sb.append("9") sb.append sb "9" if (s[i] == '9') {
				sb.append("1");
			} else {
				sb.append(s[i]);
			} s[i] == '9' s[i] s i '9' {
				sb.append("1");
			} sb.append("1") sb.append sb "1" {
				sb.append(s[i]);
			} sb.append(s[i]) sb.append sb s[i] s i System.out.println(sb) System.out.println System.out System System.out sb String args[] args
import java.util.Scanner;

class Main {
	public static void main(String args[]) {
		StringBuilder sb = new StringBuilder();
		Scanner sc = new Scanner(System.in);
		char[] s = sc.next().toCharArray();
		for (int i = 0; i < s.length; i++) {
			if (s[i] == '1') {
				sb.append("9");
			} else if (s[i] == '9') {
				sb.append("1");
			} else {
				sb.append(s[i]);
			}
		}
		System.out.println(sb);
	}
}