import java.io.*;

class Main {
  public static void main(String[] args) throws IOException {
    BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    String str = br.readLine();
    String ans = "";
    for (int i = 0; i < str.length(); i++) {
      if (str.charAt(i) == '1') {
        ans += "9";
      } else if (str.charAt(i) == '9') {
        ans += "1";
      }
    }
    System.out.println(ans);
  }
} import java.io.*; io.* java class Main {
  public static void main(String[] args) throws IOException {
    BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    String str = br.readLine();
    String ans = "";
    for (int i = 0; i < str.length(); i++) {
      if (str.charAt(i) == '1') {
        ans += "9";
      } else if (str.charAt(i) == '9') {
        ans += "1";
      }
    }
    System.out.println(ans);
  }
} Main public static void main(String[] args) throws IOException {
    BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    String str = br.readLine();
    String ans = "";
    for (int i = 0; i < str.length(); i++) {
      if (str.charAt(i) == '1') {
        ans += "9";
      } else if (str.charAt(i) == '9') {
        ans += "1";
      }
    }
    System.out.println(ans);
  } main {
    BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    String str = br.readLine();
    String ans = "";
    for (int i = 0; i < str.length(); i++) {
      if (str.charAt(i) == '1') {
        ans += "9";
      } else if (str.charAt(i) == '9') {
        ans += "1";
      }
    }
    System.out.println(ans);
  } BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); br new BufferedReader(new InputStreamReader(System.in)) String str = br.readLine(); str br.readLine() br.readLine br String ans = ""; ans "" for (int i = 0; i < str.length(); i++) {
      if (str.charAt(i) == '1') {
        ans += "9";
      } else if (str.charAt(i) == '9') {
        ans += "1";
      }
    } int i = 0; int i = 0; i 0 i < str.length() i str.length() str.length str i++ i++ i {
      if (str.charAt(i) == '1') {
        ans += "9";
      } else if (str.charAt(i) == '9') {
        ans += "1";
      }
    } {
      if (str.charAt(i) == '1') {
        ans += "9";
      } else if (str.charAt(i) == '9') {
        ans += "1";
      }
    } if (str.charAt(i) == '1') {
        ans += "9";
      } else if (str.charAt(i) == '9') {
        ans += "1";
      } str.charAt(i) == '1' str.charAt(i) str.charAt str i '1' {
        ans += "9";
      } ans += "9" ans "9" if (str.charAt(i) == '9') {
        ans += "1";
      } str.charAt(i) == '9' str.charAt(i) str.charAt str i '9' {
        ans += "1";
      } ans += "1" ans "1" System.out.println(ans) System.out.println System.out System System.out ans String[] args args
import java.io.*;

class Main {
  public static void main(String[] args) throws IOException {
    BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    String str = br.readLine();
    String ans = "";
    for (int i = 0; i < str.length(); i++) {
      if (str.charAt(i) == '1') {
        ans += "9";
      } else if (str.charAt(i) == '9') {
        ans += "1";
      }
    }
    System.out.println(ans);
  }
}