import java.util.*;
import static java.lang.Math.*;
 
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		String n = sc.next();
		char[] chars = n.toCharArray();
		for (int i=0; i<3; i++) {
			if (chars[i] == '1') chars[i] = '9';
			else if (chars[i] == '9') chars[i] = '1';
		}
		System.out.println(new String(chars));
	}
} import java.util.*; util.* java import static java.lang.Math.*; import static java.lang.Math.*; import static java.lang.Math.*; public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		String n = sc.next();
		char[] chars = n.toCharArray();
		for (int i=0; i<3; i++) {
			if (chars[i] == '1') chars[i] = '9';
			else if (chars[i] == '9') chars[i] = '1';
		}
		System.out.println(new String(chars));
	}
} Main public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		String n = sc.next();
		char[] chars = n.toCharArray();
		for (int i=0; i<3; i++) {
			if (chars[i] == '1') chars[i] = '9';
			else if (chars[i] == '9') chars[i] = '1';
		}
		System.out.println(new String(chars));
	} main {
		Scanner sc = new Scanner(System.in);
		String n = sc.next();
		char[] chars = n.toCharArray();
		for (int i=0; i<3; i++) {
			if (chars[i] == '1') chars[i] = '9';
			else if (chars[i] == '9') chars[i] = '1';
		}
		System.out.println(new String(chars));
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String n = sc.next(); n sc.next() sc.next sc char[] chars = n.toCharArray(); chars n.toCharArray() n.toCharArray n for (int i=0; i<3; i++) {
			if (chars[i] == '1') chars[i] = '9';
			else if (chars[i] == '9') chars[i] = '1';
		} int i=0; int i=0; i 0 i<3 i 3 i++ i++ i {
			if (chars[i] == '1') chars[i] = '9';
			else if (chars[i] == '9') chars[i] = '1';
		} {
			if (chars[i] == '1') chars[i] = '9';
			else if (chars[i] == '9') chars[i] = '1';
		} if (chars[i] == '1') chars[i] = '9';
			else if (chars[i] == '9') chars[i] = '1'; chars[i] == '1' chars[i] chars i '1' chars[i] = '9' chars[i] chars i '9' if (chars[i] == '9') chars[i] = '1'; chars[i] == '9' chars[i] chars i '9' chars[i] = '1' chars[i] chars i '1' System.out.println(new String(chars)) System.out.println System.out System System.out new String(chars) String[] args args public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		String n = sc.next();
		char[] chars = n.toCharArray();
		for (int i=0; i<3; i++) {
			if (chars[i] == '1') chars[i] = '9';
			else if (chars[i] == '9') chars[i] = '1';
		}
		System.out.println(new String(chars));
	}
} public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		String n = sc.next();
		char[] chars = n.toCharArray();
		for (int i=0; i<3; i++) {
			if (chars[i] == '1') chars[i] = '9';
			else if (chars[i] == '9') chars[i] = '1';
		}
		System.out.println(new String(chars));
	}
} Main
import java.util.*;
import static java.lang.Math.*;
 
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		String n = sc.next();
		char[] chars = n.toCharArray();
		for (int i=0; i<3; i++) {
			if (chars[i] == '1') chars[i] = '9';
			else if (chars[i] == '9') chars[i] = '1';
		}
		System.out.println(new String(chars));
	}
}