import java.util.*;

public class Main {
    public static void main(String[] args){
    
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();

    if(n==111){
	System.out.println("999");  
  }else if(n==191){
	System.out.println("919");  
  }else if(n==199){
	System.out.println("911");
  }else if(n==119){
	System.out.println("991");  
  }else if(n==911){
	System.out.println("199");   
  }else if(n==919){
	System.out.println("191");  
  }else if(n==991){
	System.out.println("119");  
  }else if(n==999){
	System.out.println("111");  
    }
    }
} import java.util.*; util.* java public class Main {
    public static void main(String[] args){
    
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();

    if(n==111){
	System.out.println("999");  
  }else if(n==191){
	System.out.println("919");  
  }else if(n==199){
	System.out.println("911");
  }else if(n==119){
	System.out.println("991");  
  }else if(n==911){
	System.out.println("199");   
  }else if(n==919){
	System.out.println("191");  
  }else if(n==991){
	System.out.println("119");  
  }else if(n==999){
	System.out.println("111");  
    }
    }
} Main public static void main(String[] args){
    
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();

    if(n==111){
	System.out.println("999");  
  }else if(n==191){
	System.out.println("919");  
  }else if(n==199){
	System.out.println("911");
  }else if(n==119){
	System.out.println("991");  
  }else if(n==911){
	System.out.println("199");   
  }else if(n==919){
	System.out.println("191");  
  }else if(n==991){
	System.out.println("119");  
  }else if(n==999){
	System.out.println("111");  
    }
    } main {
    
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();

    if(n==111){
	System.out.println("999");  
  }else if(n==191){
	System.out.println("919");  
  }else if(n==199){
	System.out.println("911");
  }else if(n==119){
	System.out.println("991");  
  }else if(n==911){
	System.out.println("199");   
  }else if(n==919){
	System.out.println("191");  
  }else if(n==991){
	System.out.println("119");  
  }else if(n==999){
	System.out.println("111");  
    }
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int n = sc.nextInt(); n sc.nextInt() sc.nextInt sc if(n==111){
	System.out.println("999");  
  }else if(n==191){
	System.out.println("919");  
  }else if(n==199){
	System.out.println("911");
  }else if(n==119){
	System.out.println("991");  
  }else if(n==911){
	System.out.println("199");   
  }else if(n==919){
	System.out.println("191");  
  }else if(n==991){
	System.out.println("119");  
  }else if(n==999){
	System.out.println("111");  
    } n==111 n 111 {
	System.out.println("999");  
  } System.out.println("999") System.out.println System.out System System.out "999" if(n==191){
	System.out.println("919");  
  }else if(n==199){
	System.out.println("911");
  }else if(n==119){
	System.out.println("991");  
  }else if(n==911){
	System.out.println("199");   
  }else if(n==919){
	System.out.println("191");  
  }else if(n==991){
	System.out.println("119");  
  }else if(n==999){
	System.out.println("111");  
    } n==191 n 191 {
	System.out.println("919");  
  } System.out.println("919") System.out.println System.out System System.out "919" if(n==199){
	System.out.println("911");
  }else if(n==119){
	System.out.println("991");  
  }else if(n==911){
	System.out.println("199");   
  }else if(n==919){
	System.out.println("191");  
  }else if(n==991){
	System.out.println("119");  
  }else if(n==999){
	System.out.println("111");  
    } n==199 n 199 {
	System.out.println("911");
  } System.out.println("911") System.out.println System.out System System.out "911" if(n==119){
	System.out.println("991");  
  }else if(n==911){
	System.out.println("199");   
  }else if(n==919){
	System.out.println("191");  
  }else if(n==991){
	System.out.println("119");  
  }else if(n==999){
	System.out.println("111");  
    } n==119 n 119 {
	System.out.println("991");  
  } System.out.println("991") System.out.println System.out System System.out "991" if(n==911){
	System.out.println("199");   
  }else if(n==919){
	System.out.println("191");  
  }else if(n==991){
	System.out.println("119");  
  }else if(n==999){
	System.out.println("111");  
    } n==911 n 911 {
	System.out.println("199");   
  } System.out.println("199") System.out.println System.out System System.out "199" if(n==919){
	System.out.println("191");  
  }else if(n==991){
	System.out.println("119");  
  }else if(n==999){
	System.out.println("111");  
    } n==919 n 919 {
	System.out.println("191");  
  } System.out.println("191") System.out.println System.out System System.out "191" if(n==991){
	System.out.println("119");  
  }else if(n==999){
	System.out.println("111");  
    } n==991 n 991 {
	System.out.println("119");  
  } System.out.println("119") System.out.println System.out System System.out "119" if(n==999){
	System.out.println("111");  
    } n==999 n 999 {
	System.out.println("111");  
    } System.out.println("111") System.out.println System.out System System.out "111" String[] args args public class Main {
    public static void main(String[] args){
    
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();

    if(n==111){
	System.out.println("999");  
  }else if(n==191){
	System.out.println("919");  
  }else if(n==199){
	System.out.println("911");
  }else if(n==119){
	System.out.println("991");  
  }else if(n==911){
	System.out.println("199");   
  }else if(n==919){
	System.out.println("191");  
  }else if(n==991){
	System.out.println("119");  
  }else if(n==999){
	System.out.println("111");  
    }
    }
} public class Main {
    public static void main(String[] args){
    
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();

    if(n==111){
	System.out.println("999");  
  }else if(n==191){
	System.out.println("919");  
  }else if(n==199){
	System.out.println("911");
  }else if(n==119){
	System.out.println("991");  
  }else if(n==911){
	System.out.println("199");   
  }else if(n==919){
	System.out.println("191");  
  }else if(n==991){
	System.out.println("119");  
  }else if(n==999){
	System.out.println("111");  
    }
    }
} Main
import java.util.*;

public class Main {
    public static void main(String[] args){
    
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();

    if(n==111){
	System.out.println("999");  
  }else if(n==191){
	System.out.println("919");  
  }else if(n==199){
	System.out.println("911");
  }else if(n==119){
	System.out.println("991");  
  }else if(n==911){
	System.out.println("199");   
  }else if(n==919){
	System.out.println("191");  
  }else if(n==991){
	System.out.println("119");  
  }else if(n==999){
	System.out.println("111");  
    }
    }
}
