import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		String S = in.next();
		String s="";
		for(int i=0;i<3;i++) {
			if (S.charAt(i) == '1') {
				s=s+'9';
			}else if(S.charAt(i) == '9'){
					s=s+'1';
			}else {
				s=s+S.charAt(i);
			}
		}
		

		
		System.out.print(s);

	}
} import java.util.Scanner; Scanner java.util public class Main {
	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		String S = in.next();
		String s="";
		for(int i=0;i<3;i++) {
			if (S.charAt(i) == '1') {
				s=s+'9';
			}else if(S.charAt(i) == '9'){
					s=s+'1';
			}else {
				s=s+S.charAt(i);
			}
		}
		

		
		System.out.print(s);

	}
} Main public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		String S = in.next();
		String s="";
		for(int i=0;i<3;i++) {
			if (S.charAt(i) == '1') {
				s=s+'9';
			}else if(S.charAt(i) == '9'){
					s=s+'1';
			}else {
				s=s+S.charAt(i);
			}
		}
		

		
		System.out.print(s);

	} main {
		Scanner in = new Scanner(System.in);
		String S = in.next();
		String s="";
		for(int i=0;i<3;i++) {
			if (S.charAt(i) == '1') {
				s=s+'9';
			}else if(S.charAt(i) == '9'){
					s=s+'1';
			}else {
				s=s+S.charAt(i);
			}
		}
		

		
		System.out.print(s);

	} Scanner in = new Scanner(System.in); in new Scanner(System.in) String S = in.next(); S in.next() in.next in String s=""; s "" for(int i=0;i<3;i++) {
			if (S.charAt(i) == '1') {
				s=s+'9';
			}else if(S.charAt(i) == '9'){
					s=s+'1';
			}else {
				s=s+S.charAt(i);
			}
		} int i=0; int i=0; i 0 i<3 i 3 i++ i++ i {
			if (S.charAt(i) == '1') {
				s=s+'9';
			}else if(S.charAt(i) == '9'){
					s=s+'1';
			}else {
				s=s+S.charAt(i);
			}
		} {
			if (S.charAt(i) == '1') {
				s=s+'9';
			}else if(S.charAt(i) == '9'){
					s=s+'1';
			}else {
				s=s+S.charAt(i);
			}
		} if (S.charAt(i) == '1') {
				s=s+'9';
			}else if(S.charAt(i) == '9'){
					s=s+'1';
			}else {
				s=s+S.charAt(i);
			} S.charAt(i) == '1' S.charAt(i) S.charAt S i '1' {
				s=s+'9';
			} s=s+'9' s s+'9' s '9' if(S.charAt(i) == '9'){
					s=s+'1';
			}else {
				s=s+S.charAt(i);
			} S.charAt(i) == '9' S.charAt(i) S.charAt S i '9' {
					s=s+'1';
			} s=s+'1' s s+'1' s '1' {
				s=s+S.charAt(i);
			} s=s+S.charAt(i) s s+S.charAt(i) s S.charAt(i) S.charAt S i System.out.print(s) System.out.print System.out System System.out s String[] args args public class Main {
	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		String S = in.next();
		String s="";
		for(int i=0;i<3;i++) {
			if (S.charAt(i) == '1') {
				s=s+'9';
			}else if(S.charAt(i) == '9'){
					s=s+'1';
			}else {
				s=s+S.charAt(i);
			}
		}
		

		
		System.out.print(s);

	}
} public class Main {
	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		String S = in.next();
		String s="";
		for(int i=0;i<3;i++) {
			if (S.charAt(i) == '1') {
				s=s+'9';
			}else if(S.charAt(i) == '9'){
					s=s+'1';
			}else {
				s=s+S.charAt(i);
			}
		}
		

		
		System.out.print(s);

	}
} Main
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		String S = in.next();
		String s="";
		for(int i=0;i<3;i++) {
			if (S.charAt(i) == '1') {
				s=s+'9';
			}else if(S.charAt(i) == '9'){
					s=s+'1';
			}else {
				s=s+S.charAt(i);
			}
		}
		

		
		System.out.print(s);

	}
}
