import java.util.*;

public class Main {
	
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		String n = sc.next();
		StringBuilder value = new StringBuilder();
		for (int i = 0; i < n.length(); i++) {
			switch (n.charAt(i)) {
				case '1' :
				value.append('9');
				break;
				case '9' :
				value.append('1');
				break;
				default :
				value.append(n.charAt(i));
			}
		}
		System.out.println(value);
	}
	
} import java.util.*; util.* java public class Main {
	
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		String n = sc.next();
		StringBuilder value = new StringBuilder();
		for (int i = 0; i < n.length(); i++) {
			switch (n.charAt(i)) {
				case '1' :
				value.append('9');
				break;
				case '9' :
				value.append('1');
				break;
				default :
				value.append(n.charAt(i));
			}
		}
		System.out.println(value);
	}
	
} Main public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		String n = sc.next();
		StringBuilder value = new StringBuilder();
		for (int i = 0; i < n.length(); i++) {
			switch (n.charAt(i)) {
				case '1' :
				value.append('9');
				break;
				case '9' :
				value.append('1');
				break;
				default :
				value.append(n.charAt(i));
			}
		}
		System.out.println(value);
	} main {
		Scanner sc = new Scanner(System.in);
		String n = sc.next();
		StringBuilder value = new StringBuilder();
		for (int i = 0; i < n.length(); i++) {
			switch (n.charAt(i)) {
				case '1' :
				value.append('9');
				break;
				case '9' :
				value.append('1');
				break;
				default :
				value.append(n.charAt(i));
			}
		}
		System.out.println(value);
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String n = sc.next(); n sc.next() sc.next sc StringBuilder value = new StringBuilder(); value new StringBuilder() for (int i = 0; i < n.length(); i++) {
			switch (n.charAt(i)) {
				case '1' :
				value.append('9');
				break;
				case '9' :
				value.append('1');
				break;
				default :
				value.append(n.charAt(i));
			}
		} int i = 0; int i = 0; i 0 i < n.length() i n.length() n.length n i++ i++ i {
			switch (n.charAt(i)) {
				case '1' :
				value.append('9');
				break;
				case '9' :
				value.append('1');
				break;
				default :
				value.append(n.charAt(i));
			}
		} {
			switch (n.charAt(i)) {
				case '1' :
				value.append('9');
				break;
				case '9' :
				value.append('1');
				break;
				default :
				value.append(n.charAt(i));
			}
		} switch (n.charAt(i)) {
				case '1' :
				value.append('9');
				break;
				case '9' :
				value.append('1');
				break;
				default :
				value.append(n.charAt(i));
			} n.charAt(i) n.charAt n i case '1' : '1' case '1' : value.append('9') value.append value '9' break; case '9' : '9' case '9' : value.append('1') value.append value '1' break; default : default : value.append(n.charAt(i)) value.append value n.charAt(i) n.charAt n i System.out.println(value) System.out.println System.out System System.out value String[] args args public class Main {
	
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		String n = sc.next();
		StringBuilder value = new StringBuilder();
		for (int i = 0; i < n.length(); i++) {
			switch (n.charAt(i)) {
				case '1' :
				value.append('9');
				break;
				case '9' :
				value.append('1');
				break;
				default :
				value.append(n.charAt(i));
			}
		}
		System.out.println(value);
	}
	
} public class Main {
	
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		String n = sc.next();
		StringBuilder value = new StringBuilder();
		for (int i = 0; i < n.length(); i++) {
			switch (n.charAt(i)) {
				case '1' :
				value.append('9');
				break;
				case '9' :
				value.append('1');
				break;
				default :
				value.append(n.charAt(i));
			}
		}
		System.out.println(value);
	}
	
} Main
import java.util.*;

public class Main {
	
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		String n = sc.next();
		StringBuilder value = new StringBuilder();
		for (int i = 0; i < n.length(); i++) {
			switch (n.charAt(i)) {
				case '1' :
				value.append('9');
				break;
				case '9' :
				value.append('1');
				break;
				default :
				value.append(n.charAt(i));
			}
		}
		System.out.println(value);
	}
	
}