import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {

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

        Scanner sc = new Scanner(System.in);
        String strN = sc.next();
        
        String ans = "";
        for(int i = 0; i < strN.length(); i++){
            if( strN.charAt(i) == '1' ){
                ans += "9";
            } else if( strN.charAt(i) == '9' ){
                ans += "1";
            } else {
                ans += strN.charAt(i);
            }       
        }
        
        System.out.println(ans);
        
    }
} Main public static void main(String[] args) throws Exception {

        Scanner sc = new Scanner(System.in);
        String strN = sc.next();
        
        String ans = "";
        for(int i = 0; i < strN.length(); i++){
            if( strN.charAt(i) == '1' ){
                ans += "9";
            } else if( strN.charAt(i) == '9' ){
                ans += "1";
            } else {
                ans += strN.charAt(i);
            }       
        }
        
        System.out.println(ans);
        
    } main {

        Scanner sc = new Scanner(System.in);
        String strN = sc.next();
        
        String ans = "";
        for(int i = 0; i < strN.length(); i++){
            if( strN.charAt(i) == '1' ){
                ans += "9";
            } else if( strN.charAt(i) == '9' ){
                ans += "1";
            } else {
                ans += strN.charAt(i);
            }       
        }
        
        System.out.println(ans);
        
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String strN = sc.next(); strN sc.next() sc.next sc String ans = ""; ans "" for(int i = 0; i < strN.length(); i++){
            if( strN.charAt(i) == '1' ){
                ans += "9";
            } else if( strN.charAt(i) == '9' ){
                ans += "1";
            } else {
                ans += strN.charAt(i);
            }       
        } int i = 0; int i = 0; i 0 i < strN.length() i strN.length() strN.length strN i++ i++ i {
            if( strN.charAt(i) == '1' ){
                ans += "9";
            } else if( strN.charAt(i) == '9' ){
                ans += "1";
            } else {
                ans += strN.charAt(i);
            }       
        } {
            if( strN.charAt(i) == '1' ){
                ans += "9";
            } else if( strN.charAt(i) == '9' ){
                ans += "1";
            } else {
                ans += strN.charAt(i);
            }       
        } if( strN.charAt(i) == '1' ){
                ans += "9";
            } else if( strN.charAt(i) == '9' ){
                ans += "1";
            } else {
                ans += strN.charAt(i);
            } strN.charAt(i) == '1' strN.charAt(i) strN.charAt strN i '1' {
                ans += "9";
            } ans += "9" ans "9" if( strN.charAt(i) == '9' ){
                ans += "1";
            } else {
                ans += strN.charAt(i);
            } strN.charAt(i) == '9' strN.charAt(i) strN.charAt strN i '9' {
                ans += "1";
            } ans += "1" ans "1" {
                ans += strN.charAt(i);
            } ans += strN.charAt(i) ans strN.charAt(i) strN.charAt strN i System.out.println(ans) System.out.println System.out System System.out ans String[] args args public class Main {
    public static void main(String[] args) throws Exception {

        Scanner sc = new Scanner(System.in);
        String strN = sc.next();
        
        String ans = "";
        for(int i = 0; i < strN.length(); i++){
            if( strN.charAt(i) == '1' ){
                ans += "9";
            } else if( strN.charAt(i) == '9' ){
                ans += "1";
            } else {
                ans += strN.charAt(i);
            }       
        }
        
        System.out.println(ans);
        
    }
} public class Main {
    public static void main(String[] args) throws Exception {

        Scanner sc = new Scanner(System.in);
        String strN = sc.next();
        
        String ans = "";
        for(int i = 0; i < strN.length(); i++){
            if( strN.charAt(i) == '1' ){
                ans += "9";
            } else if( strN.charAt(i) == '9' ){
                ans += "1";
            } else {
                ans += strN.charAt(i);
            }       
        }
        
        System.out.println(ans);
        
    }
} Main
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {

        Scanner sc = new Scanner(System.in);
        String strN = sc.next();
        
        String ans = "";
        for(int i = 0; i < strN.length(); i++){
            if( strN.charAt(i) == '1' ){
                ans += "9";
            } else if( strN.charAt(i) == '9' ){
                ans += "1";
            } else {
                ans += strN.charAt(i);
            }       
        }
        
        System.out.println(ans);
        
    }
}
