import java.util.Scanner;
public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		char[] arr = String.valueOf(n).toCharArray();
		for (int i = 0; i < arr.length; i++) {
			if (arr[i] == '9') {
				arr[i] = '1';
			} else {
				arr[i] = '9';
			}
		}
		System.out.println(Integer.valueOf(new String(arr)));
	}
} 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();
		char[] arr = String.valueOf(n).toCharArray();
		for (int i = 0; i < arr.length; i++) {
			if (arr[i] == '9') {
				arr[i] = '1';
			} else {
				arr[i] = '9';
			}
		}
		System.out.println(Integer.valueOf(new String(arr)));
	}
} Main public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		char[] arr = String.valueOf(n).toCharArray();
		for (int i = 0; i < arr.length; i++) {
			if (arr[i] == '9') {
				arr[i] = '1';
			} else {
				arr[i] = '9';
			}
		}
		System.out.println(Integer.valueOf(new String(arr)));
	} main {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		char[] arr = String.valueOf(n).toCharArray();
		for (int i = 0; i < arr.length; i++) {
			if (arr[i] == '9') {
				arr[i] = '1';
			} else {
				arr[i] = '9';
			}
		}
		System.out.println(Integer.valueOf(new String(arr)));
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int n = sc.nextInt(); n sc.nextInt() sc.nextInt sc char[] arr = String.valueOf(n).toCharArray(); arr String.valueOf(n).toCharArray() String.valueOf(n).toCharArray String.valueOf(n) String.valueOf String n for (int i = 0; i < arr.length; i++) {
			if (arr[i] == '9') {
				arr[i] = '1';
			} else {
				arr[i] = '9';
			}
		} int i = 0; int i = 0; i 0 i < arr.length i arr.length arr arr.length i++ i++ i {
			if (arr[i] == '9') {
				arr[i] = '1';
			} else {
				arr[i] = '9';
			}
		} {
			if (arr[i] == '9') {
				arr[i] = '1';
			} else {
				arr[i] = '9';
			}
		} if (arr[i] == '9') {
				arr[i] = '1';
			} else {
				arr[i] = '9';
			} arr[i] == '9' arr[i] arr i '9' {
				arr[i] = '1';
			} arr[i] = '1' arr[i] arr i '1' {
				arr[i] = '9';
			} arr[i] = '9' arr[i] arr i '9' System.out.println(Integer.valueOf(new String(arr))) System.out.println System.out System System.out Integer.valueOf(new String(arr)) Integer.valueOf Integer new String(arr) String[] args args public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		char[] arr = String.valueOf(n).toCharArray();
		for (int i = 0; i < arr.length; i++) {
			if (arr[i] == '9') {
				arr[i] = '1';
			} else {
				arr[i] = '9';
			}
		}
		System.out.println(Integer.valueOf(new String(arr)));
	}
} public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		char[] arr = String.valueOf(n).toCharArray();
		for (int i = 0; i < arr.length; i++) {
			if (arr[i] == '9') {
				arr[i] = '1';
			} else {
				arr[i] = '9';
			}
		}
		System.out.println(Integer.valueOf(new String(arr)));
	}
} Main
import java.util.Scanner;
public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		char[] arr = String.valueOf(n).toCharArray();
		for (int i = 0; i < arr.length; i++) {
			if (arr[i] == '9') {
				arr[i] = '1';
			} else {
				arr[i] = '9';
			}
		}
		System.out.println(Integer.valueOf(new String(arr)));
	}
}