import java.util.*;

class Main{

    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        String s = Integer.toString(n);
        StringBuilder sb = new StringBuilder();
        for(int i=0;i<s.length();i++){
            if(s.charAt(i)=='1') sb.append("9");
            else if(s.charAt(i)=='9') sb.append("1");
            else sb.append(s.charAt(i));
        }


        System.out.println(sb.toString());
    }
} import java.util.*; util.* java class Main{

    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        String s = Integer.toString(n);
        StringBuilder sb = new StringBuilder();
        for(int i=0;i<s.length();i++){
            if(s.charAt(i)=='1') sb.append("9");
            else if(s.charAt(i)=='9') sb.append("1");
            else sb.append(s.charAt(i));
        }


        System.out.println(sb.toString());
    }
} Main public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        String s = Integer.toString(n);
        StringBuilder sb = new StringBuilder();
        for(int i=0;i<s.length();i++){
            if(s.charAt(i)=='1') sb.append("9");
            else if(s.charAt(i)=='9') sb.append("1");
            else sb.append(s.charAt(i));
        }


        System.out.println(sb.toString());
    } main {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        String s = Integer.toString(n);
        StringBuilder sb = new StringBuilder();
        for(int i=0;i<s.length();i++){
            if(s.charAt(i)=='1') sb.append("9");
            else if(s.charAt(i)=='9') sb.append("1");
            else sb.append(s.charAt(i));
        }


        System.out.println(sb.toString());
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int n = sc.nextInt(); n sc.nextInt() sc.nextInt sc String s = Integer.toString(n); s Integer.toString(n) Integer.toString Integer n StringBuilder sb = new StringBuilder(); sb new StringBuilder() for(int i=0;i<s.length();i++){
            if(s.charAt(i)=='1') sb.append("9");
            else if(s.charAt(i)=='9') sb.append("1");
            else sb.append(s.charAt(i));
        } int i=0; int i=0; i 0 i<s.length() i s.length() s.length s i++ i++ i {
            if(s.charAt(i)=='1') sb.append("9");
            else if(s.charAt(i)=='9') sb.append("1");
            else sb.append(s.charAt(i));
        } {
            if(s.charAt(i)=='1') sb.append("9");
            else if(s.charAt(i)=='9') sb.append("1");
            else sb.append(s.charAt(i));
        } if(s.charAt(i)=='1') sb.append("9");
            else if(s.charAt(i)=='9') sb.append("1");
            else sb.append(s.charAt(i)); s.charAt(i)=='1' s.charAt(i) s.charAt s i '1' sb.append("9") sb.append sb "9" if(s.charAt(i)=='9') sb.append("1");
            else sb.append(s.charAt(i)); s.charAt(i)=='9' s.charAt(i) s.charAt s i '9' sb.append("1") sb.append sb "1" sb.append(s.charAt(i)) sb.append sb s.charAt(i) s.charAt s i System.out.println(sb.toString()) System.out.println System.out System System.out sb.toString() sb.toString sb String[] args args
import java.util.*;

class Main{

    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        String s = Integer.toString(n);
        StringBuilder sb = new StringBuilder();
        for(int i=0;i<s.length();i++){
            if(s.charAt(i)=='1') sb.append("9");
            else if(s.charAt(i)=='9') sb.append("1");
            else sb.append(s.charAt(i));
        }


        System.out.println(sb.toString());
    }
}
