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