import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String S = sc.nextLine();
      StringBuilder sb = new StringBuilder();
      
      for (int j = 0;j < S.length();j++){
        if(S.charAt(j) == '1') {
          sb.append('9');
        } else if(S.charAt(j) == '9') {
          sb.append('1');
        } else{
          sb.append(S.charAt(j));
        }
      }
      S = sb.toString();
      println(S);
        return ;
    }
    static long getLong(String val) {return Long.parseLong(val);}
    static int getInt(String val) {
        return Integer.parseInt(val);
    }

    static void println(String val){System.out.println(val);};
    static void println(int val){System.out.println(val);};
    static void println(long val){System.out.println(val);};
    static void println(Object val){System.out.println(val);};
} import java.util.*; util.* java public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String S = sc.nextLine();
      StringBuilder sb = new StringBuilder();
      
      for (int j = 0;j < S.length();j++){
        if(S.charAt(j) == '1') {
          sb.append('9');
        } else if(S.charAt(j) == '9') {
          sb.append('1');
        } else{
          sb.append(S.charAt(j));
        }
      }
      S = sb.toString();
      println(S);
        return ;
    }
    static long getLong(String val) {return Long.parseLong(val);}
    static int getInt(String val) {
        return Integer.parseInt(val);
    }

    static void println(String val){System.out.println(val);};
    static void println(int val){System.out.println(val);};
    static void println(long val){System.out.println(val);};
    static void println(Object val){System.out.println(val);};
} Main public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String S = sc.nextLine();
      StringBuilder sb = new StringBuilder();
      
      for (int j = 0;j < S.length();j++){
        if(S.charAt(j) == '1') {
          sb.append('9');
        } else if(S.charAt(j) == '9') {
          sb.append('1');
        } else{
          sb.append(S.charAt(j));
        }
      }
      S = sb.toString();
      println(S);
        return ;
    } main {
        Scanner sc = new Scanner(System.in);
        String S = sc.nextLine();
      StringBuilder sb = new StringBuilder();
      
      for (int j = 0;j < S.length();j++){
        if(S.charAt(j) == '1') {
          sb.append('9');
        } else if(S.charAt(j) == '9') {
          sb.append('1');
        } else{
          sb.append(S.charAt(j));
        }
      }
      S = sb.toString();
      println(S);
        return ;
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String S = sc.nextLine(); S sc.nextLine() sc.nextLine sc StringBuilder sb = new StringBuilder(); sb new StringBuilder() for (int j = 0;j < S.length();j++){
        if(S.charAt(j) == '1') {
          sb.append('9');
        } else if(S.charAt(j) == '9') {
          sb.append('1');
        } else{
          sb.append(S.charAt(j));
        }
      } int j = 0; int j = 0; j 0 j < S.length() j S.length() S.length S j++ j++ j {
        if(S.charAt(j) == '1') {
          sb.append('9');
        } else if(S.charAt(j) == '9') {
          sb.append('1');
        } else{
          sb.append(S.charAt(j));
        }
      } {
        if(S.charAt(j) == '1') {
          sb.append('9');
        } else if(S.charAt(j) == '9') {
          sb.append('1');
        } else{
          sb.append(S.charAt(j));
        }
      } if(S.charAt(j) == '1') {
          sb.append('9');
        } else if(S.charAt(j) == '9') {
          sb.append('1');
        } else{
          sb.append(S.charAt(j));
        } S.charAt(j) == '1' S.charAt(j) S.charAt S j '1' {
          sb.append('9');
        } sb.append('9') sb.append sb '9' if(S.charAt(j) == '9') {
          sb.append('1');
        } else{
          sb.append(S.charAt(j));
        } S.charAt(j) == '9' S.charAt(j) S.charAt S j '9' {
          sb.append('1');
        } sb.append('1') sb.append sb '1' {
          sb.append(S.charAt(j));
        } sb.append(S.charAt(j)) sb.append sb S.charAt(j) S.charAt S j S = sb.toString() S sb.toString() sb.toString sb println(S) println S return ; String[] args args static long getLong(String val) {return Long.parseLong(val);} getLong {return Long.parseLong(val);} return Long.parseLong(val); Long.parseLong(val) Long.parseLong Long val String val val static int getInt(String val) {
        return Integer.parseInt(val);
    } getInt {
        return Integer.parseInt(val);
    } return Integer.parseInt(val); Integer.parseInt(val) Integer.parseInt Integer val String val val static void println(String val){System.out.println(val);} println {System.out.println(val);} System.out.println(val) System.out.println System.out System System.out val String val val static void println(int val){System.out.println(val);} println {System.out.println(val);} System.out.println(val) System.out.println System.out System System.out val int val val static void println(long val){System.out.println(val);} println {System.out.println(val);} System.out.println(val) System.out.println System.out System System.out val long val val static void println(Object val){System.out.println(val);} println {System.out.println(val);} System.out.println(val) System.out.println System.out System System.out val Object val val public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String S = sc.nextLine();
      StringBuilder sb = new StringBuilder();
      
      for (int j = 0;j < S.length();j++){
        if(S.charAt(j) == '1') {
          sb.append('9');
        } else if(S.charAt(j) == '9') {
          sb.append('1');
        } else{
          sb.append(S.charAt(j));
        }
      }
      S = sb.toString();
      println(S);
        return ;
    }
    static long getLong(String val) {return Long.parseLong(val);}
    static int getInt(String val) {
        return Integer.parseInt(val);
    }

    static void println(String val){System.out.println(val);};
    static void println(int val){System.out.println(val);};
    static void println(long val){System.out.println(val);};
    static void println(Object val){System.out.println(val);};
} public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String S = sc.nextLine();
      StringBuilder sb = new StringBuilder();
      
      for (int j = 0;j < S.length();j++){
        if(S.charAt(j) == '1') {
          sb.append('9');
        } else if(S.charAt(j) == '9') {
          sb.append('1');
        } else{
          sb.append(S.charAt(j));
        }
      }
      S = sb.toString();
      println(S);
        return ;
    }
    static long getLong(String val) {return Long.parseLong(val);}
    static int getInt(String val) {
        return Integer.parseInt(val);
    }

    static void println(String val){System.out.println(val);};
    static void println(int val){System.out.println(val);};
    static void println(long val){System.out.println(val);};
    static void println(Object val){System.out.println(val);};
} Main
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String S = sc.nextLine();
      StringBuilder sb = new StringBuilder();
      
      for (int j = 0;j < S.length();j++){
        if(S.charAt(j) == '1') {
          sb.append('9');
        } else if(S.charAt(j) == '9') {
          sb.append('1');
        } else{
          sb.append(S.charAt(j));
        }
      }
      S = sb.toString();
      println(S);
        return ;
    }
    static long getLong(String val) {return Long.parseLong(val);}
    static int getInt(String val) {
        return Integer.parseInt(val);
    }

    static void println(String val){System.out.println(val);};
    static void println(int val){System.out.println(val);};
    static void println(long val){System.out.println(val);};
    static void println(Object val){System.out.println(val);};
}
