import java.io.BufferedReader;
import java.io.*;
import java.util.*;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.Collections;

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

        int n = sc.nextInt();
        
        if(n == 111){
            System.out.println(999);
        }else if(n == 119){
            System.out.println(991);
        }else if(n == 199){
            System.out.println(911);
        }else if(n == 191){
            System.out.println(919);
        }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{
            System.out.println(111);
        }
        






    }
} import java.io.BufferedReader; BufferedReader java.io import java.io.*; io.* java import java.util.*; util.* java import java.util.ArrayList; ArrayList java.util import java.util.Iterator; Iterator java.util import java.util.List; List java.util import java.util.Collections; Collections java.util public class Main {
	public static void main(final String[] args){
    
        Scanner sc = new Scanner(System.in);

        int n = sc.nextInt();
        
        if(n == 111){
            System.out.println(999);
        }else if(n == 119){
            System.out.println(991);
        }else if(n == 199){
            System.out.println(911);
        }else if(n == 191){
            System.out.println(919);
        }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{
            System.out.println(111);
        }
        






    }
} Main public static void main(final String[] args){
    
        Scanner sc = new Scanner(System.in);

        int n = sc.nextInt();
        
        if(n == 111){
            System.out.println(999);
        }else if(n == 119){
            System.out.println(991);
        }else if(n == 199){
            System.out.println(911);
        }else if(n == 191){
            System.out.println(919);
        }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{
            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 == 119){
            System.out.println(991);
        }else if(n == 199){
            System.out.println(911);
        }else if(n == 191){
            System.out.println(919);
        }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{
            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 == 119){
            System.out.println(991);
        }else if(n == 199){
            System.out.println(911);
        }else if(n == 191){
            System.out.println(919);
        }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{
            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 == 119){
            System.out.println(991);
        }else if(n == 199){
            System.out.println(911);
        }else if(n == 191){
            System.out.println(919);
        }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{
            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 == 199){
            System.out.println(911);
        }else if(n == 191){
            System.out.println(919);
        }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{
            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 == 191){
            System.out.println(919);
        }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{
            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 == 911){
            System.out.println(199);
        }else if(n == 919){
            System.out.println(191);
        }else if(n == 991){
            System.out.println(119);
        }else{
            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{
            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{
            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 {
            System.out.println(111);
        } System.out.println(111) System.out.println System.out System System.out 111 final String[] args args public class Main {
	public static void main(final String[] args){
    
        Scanner sc = new Scanner(System.in);

        int n = sc.nextInt();
        
        if(n == 111){
            System.out.println(999);
        }else if(n == 119){
            System.out.println(991);
        }else if(n == 199){
            System.out.println(911);
        }else if(n == 191){
            System.out.println(919);
        }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{
            System.out.println(111);
        }
        






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

        int n = sc.nextInt();
        
        if(n == 111){
            System.out.println(999);
        }else if(n == 119){
            System.out.println(991);
        }else if(n == 199){
            System.out.println(911);
        }else if(n == 191){
            System.out.println(919);
        }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{
            System.out.println(111);
        }
        






    }
} Main
import java.io.BufferedReader;
import java.io.*;
import java.util.*;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.Collections;

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

        int n = sc.nextInt();
        
        if(n == 111){
            System.out.println(999);
        }else if(n == 119){
            System.out.println(991);
        }else if(n == 199){
            System.out.println(911);
        }else if(n == 191){
            System.out.println(919);
        }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{
            System.out.println(111);
        }
        






    }
}