import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner scn = new Scanner(System.in);
    int n = scn.nextInt();
    char[] charN = String.valueOf(n).toCharArray();

    String ans = "";
    for (char num : charN) {
      ans += (num == '1') ? "9" : "1";
    }

    System.out.println(ans);

  }

} import java.util.*; util.* java public class Main {
  public static void main(String[] args) {
    Scanner scn = new Scanner(System.in);
    int n = scn.nextInt();
    char[] charN = String.valueOf(n).toCharArray();

    String ans = "";
    for (char num : charN) {
      ans += (num == '1') ? "9" : "1";
    }

    System.out.println(ans);

  }

} Main public static void main(String[] args) {
    Scanner scn = new Scanner(System.in);
    int n = scn.nextInt();
    char[] charN = String.valueOf(n).toCharArray();

    String ans = "";
    for (char num : charN) {
      ans += (num == '1') ? "9" : "1";
    }

    System.out.println(ans);

  } main {
    Scanner scn = new Scanner(System.in);
    int n = scn.nextInt();
    char[] charN = String.valueOf(n).toCharArray();

    String ans = "";
    for (char num : charN) {
      ans += (num == '1') ? "9" : "1";
    }

    System.out.println(ans);

  } Scanner scn = new Scanner(System.in); scn new Scanner(System.in) int n = scn.nextInt(); n scn.nextInt() scn.nextInt scn char[] charN = String.valueOf(n).toCharArray(); charN String.valueOf(n).toCharArray() String.valueOf(n).toCharArray String.valueOf(n) String.valueOf String n String ans = ""; ans "" for (char num : charN) {
      ans += (num == '1') ? "9" : "1";
    } char num charN {
      ans += (num == '1') ? "9" : "1";
    } {
      ans += (num == '1') ? "9" : "1";
    } ans += (num == '1') ? "9" : "1" ans (num == '1') ? "9" : "1" (num == '1') num '1' "9" "1" 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) {
    Scanner scn = new Scanner(System.in);
    int n = scn.nextInt();
    char[] charN = String.valueOf(n).toCharArray();

    String ans = "";
    for (char num : charN) {
      ans += (num == '1') ? "9" : "1";
    }

    System.out.println(ans);

  }

} public class Main {
  public static void main(String[] args) {
    Scanner scn = new Scanner(System.in);
    int n = scn.nextInt();
    char[] charN = String.valueOf(n).toCharArray();

    String ans = "";
    for (char num : charN) {
      ans += (num == '1') ? "9" : "1";
    }

    System.out.println(ans);

  }

} Main
import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner scn = new Scanner(System.in);
    int n = scn.nextInt();
    char[] charN = String.valueOf(n).toCharArray();

    String ans = "";
    for (char num : charN) {
      ans += (num == '1') ? "9" : "1";
    }

    System.out.println(ans);

  }

}
