    import java.util.*;
    public class Main {
     
    	public static void main(String[] args) {
    			
    		Scanner scan =new Scanner(System.in);
    		char[]n=scan.next().toCharArray();
    		for (char i:n) {
    			if(i=='1') {
    				System.out.print("9");
    			}else if(i=='9'){
    				System.out.print(1);
    			}else {
    				System.out.print(i);
    			}
    		}
    }
    }
// end  import java.util.*; util.* java public class Main {
     
    	public static void main(String[] args) {
    			
    		Scanner scan =new Scanner(System.in);
    		char[]n=scan.next().toCharArray();
    		for (char i:n) {
    			if(i=='1') {
    				System.out.print("9");
    			}else if(i=='9'){
    				System.out.print(1);
    			}else {
    				System.out.print(i);
    			}
    		}
    }
    } Main public static void main(String[] args) {
    			
    		Scanner scan =new Scanner(System.in);
    		char[]n=scan.next().toCharArray();
    		for (char i:n) {
    			if(i=='1') {
    				System.out.print("9");
    			}else if(i=='9'){
    				System.out.print(1);
    			}else {
    				System.out.print(i);
    			}
    		}
    } main {
    			
    		Scanner scan =new Scanner(System.in);
    		char[]n=scan.next().toCharArray();
    		for (char i:n) {
    			if(i=='1') {
    				System.out.print("9");
    			}else if(i=='9'){
    				System.out.print(1);
    			}else {
    				System.out.print(i);
    			}
    		}
    } Scanner scan =new Scanner(System.in); scan new Scanner(System.in) char[]n=scan.next().toCharArray(); n scan.next().toCharArray() scan.next().toCharArray scan.next() scan.next scan for (char i:n) {
    			if(i=='1') {
    				System.out.print("9");
    			}else if(i=='9'){
    				System.out.print(1);
    			}else {
    				System.out.print(i);
    			}
    		} char i n {
    			if(i=='1') {
    				System.out.print("9");
    			}else if(i=='9'){
    				System.out.print(1);
    			}else {
    				System.out.print(i);
    			}
    		} {
    			if(i=='1') {
    				System.out.print("9");
    			}else if(i=='9'){
    				System.out.print(1);
    			}else {
    				System.out.print(i);
    			}
    		} if(i=='1') {
    				System.out.print("9");
    			}else if(i=='9'){
    				System.out.print(1);
    			}else {
    				System.out.print(i);
    			} i=='1' i '1' {
    				System.out.print("9");
    			} System.out.print("9") System.out.print System.out System System.out "9" if(i=='9'){
    				System.out.print(1);
    			}else {
    				System.out.print(i);
    			} i=='9' i '9' {
    				System.out.print(1);
    			} System.out.print(1) System.out.print System.out System System.out 1 {
    				System.out.print(i);
    			} System.out.print(i) System.out.print System.out System System.out i String[] args args public class Main {
     
    	public static void main(String[] args) {
    			
    		Scanner scan =new Scanner(System.in);
    		char[]n=scan.next().toCharArray();
    		for (char i:n) {
    			if(i=='1') {
    				System.out.print("9");
    			}else if(i=='9'){
    				System.out.print(1);
    			}else {
    				System.out.print(i);
    			}
    		}
    }
    } public class Main {
     
    	public static void main(String[] args) {
    			
    		Scanner scan =new Scanner(System.in);
    		char[]n=scan.next().toCharArray();
    		for (char i:n) {
    			if(i=='1') {
    				System.out.print("9");
    			}else if(i=='9'){
    				System.out.print(1);
    			}else {
    				System.out.print(i);
    			}
    		}
    }
    } Main
    import java.util.*;
    public class Main {
     
    	public static void main(String[] args) {
    			
    		Scanner scan =new Scanner(System.in);
    		char[]n=scan.next().toCharArray();
    		for (char i:n) {
    			if(i=='1') {
    				System.out.print("9");
    			}else if(i=='9'){
    				System.out.print(1);
    			}else {
    				System.out.print(i);
    			}
    		}
    }
    }
// end 