import java.util.Scanner;

public class Main {
	
	public static void main(String[] args) throws Exception {
	    Scanner sc = new Scanner(System.in);   
	    
	    String N = sc.next();
	    
	    for (char c : N.toCharArray()) {
	    	if (c == '1') {
	    		System.out.print('9');
	    	} else if (c == '9' ) {
	    		System.out.print('1');
	    	} else {
	    		System.out.print(c);
	    	}
	    }
	    
	    System.out.println();
	    
	}    
}	 import java.util.Scanner; Scanner java.util public class Main {
	
	public static void main(String[] args) throws Exception {
	    Scanner sc = new Scanner(System.in);   
	    
	    String N = sc.next();
	    
	    for (char c : N.toCharArray()) {
	    	if (c == '1') {
	    		System.out.print('9');
	    	} else if (c == '9' ) {
	    		System.out.print('1');
	    	} else {
	    		System.out.print(c);
	    	}
	    }
	    
	    System.out.println();
	    
	}    
} Main public static void main(String[] args) throws Exception {
	    Scanner sc = new Scanner(System.in);   
	    
	    String N = sc.next();
	    
	    for (char c : N.toCharArray()) {
	    	if (c == '1') {
	    		System.out.print('9');
	    	} else if (c == '9' ) {
	    		System.out.print('1');
	    	} else {
	    		System.out.print(c);
	    	}
	    }
	    
	    System.out.println();
	    
	} main {
	    Scanner sc = new Scanner(System.in);   
	    
	    String N = sc.next();
	    
	    for (char c : N.toCharArray()) {
	    	if (c == '1') {
	    		System.out.print('9');
	    	} else if (c == '9' ) {
	    		System.out.print('1');
	    	} else {
	    		System.out.print(c);
	    	}
	    }
	    
	    System.out.println();
	    
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String N = sc.next(); N sc.next() sc.next sc for (char c : N.toCharArray()) {
	    	if (c == '1') {
	    		System.out.print('9');
	    	} else if (c == '9' ) {
	    		System.out.print('1');
	    	} else {
	    		System.out.print(c);
	    	}
	    } char c N.toCharArray() N.toCharArray N {
	    	if (c == '1') {
	    		System.out.print('9');
	    	} else if (c == '9' ) {
	    		System.out.print('1');
	    	} else {
	    		System.out.print(c);
	    	}
	    } {
	    	if (c == '1') {
	    		System.out.print('9');
	    	} else if (c == '9' ) {
	    		System.out.print('1');
	    	} else {
	    		System.out.print(c);
	    	}
	    } if (c == '1') {
	    		System.out.print('9');
	    	} else if (c == '9' ) {
	    		System.out.print('1');
	    	} else {
	    		System.out.print(c);
	    	} c == '1' c '1' {
	    		System.out.print('9');
	    	} System.out.print('9') System.out.print System.out System System.out '9' if (c == '9' ) {
	    		System.out.print('1');
	    	} else {
	    		System.out.print(c);
	    	} c == '9' c '9' {
	    		System.out.print('1');
	    	} System.out.print('1') System.out.print System.out System System.out '1' {
	    		System.out.print(c);
	    	} System.out.print(c) System.out.print System.out System System.out c System.out.println() System.out.println System.out System System.out String[] args args public class Main {
	
	public static void main(String[] args) throws Exception {
	    Scanner sc = new Scanner(System.in);   
	    
	    String N = sc.next();
	    
	    for (char c : N.toCharArray()) {
	    	if (c == '1') {
	    		System.out.print('9');
	    	} else if (c == '9' ) {
	    		System.out.print('1');
	    	} else {
	    		System.out.print(c);
	    	}
	    }
	    
	    System.out.println();
	    
	}    
} public class Main {
	
	public static void main(String[] args) throws Exception {
	    Scanner sc = new Scanner(System.in);   
	    
	    String N = sc.next();
	    
	    for (char c : N.toCharArray()) {
	    	if (c == '1') {
	    		System.out.print('9');
	    	} else if (c == '9' ) {
	    		System.out.print('1');
	    	} else {
	    		System.out.print(c);
	    	}
	    }
	    
	    System.out.println();
	    
	}    
} Main
import java.util.Scanner;

public class Main {
	
	public static void main(String[] args) throws Exception {
	    Scanner sc = new Scanner(System.in);   
	    
	    String N = sc.next();
	    
	    for (char c : N.toCharArray()) {
	    	if (c == '1') {
	    		System.out.print('9');
	    	} else if (c == '9' ) {
	    		System.out.print('1');
	    	} else {
	    		System.out.print(c);
	    	}
	    }
	    
	    System.out.println();
	    
	}    
}	