import java.util.Scanner;

public class Main {

  public static void main(String[] args) {

    Scanner sc = new Scanner(System.in);

    String input = sc.next();
    char in[] = new char[3];
    for (int i = 0; i < 3; i++) {
      in[i] = input.charAt(i);
      if (in[i] == '1') {
        in[i] = 9;
      } else if (in[i] == '9') {
        in[i] = 1;
      }
    }

    int ans = in[0] * 100 + in[1] * 10 + in[2];
    System.out.println(ans);
  }
} import java.util.Scanner; Scanner java.util public class Main {

  public static void main(String[] args) {

    Scanner sc = new Scanner(System.in);

    String input = sc.next();
    char in[] = new char[3];
    for (int i = 0; i < 3; i++) {
      in[i] = input.charAt(i);
      if (in[i] == '1') {
        in[i] = 9;
      } else if (in[i] == '9') {
        in[i] = 1;
      }
    }

    int ans = in[0] * 100 + in[1] * 10 + in[2];
    System.out.println(ans);
  }
} Main public static void main(String[] args) {

    Scanner sc = new Scanner(System.in);

    String input = sc.next();
    char in[] = new char[3];
    for (int i = 0; i < 3; i++) {
      in[i] = input.charAt(i);
      if (in[i] == '1') {
        in[i] = 9;
      } else if (in[i] == '9') {
        in[i] = 1;
      }
    }

    int ans = in[0] * 100 + in[1] * 10 + in[2];
    System.out.println(ans);
  } main {

    Scanner sc = new Scanner(System.in);

    String input = sc.next();
    char in[] = new char[3];
    for (int i = 0; i < 3; i++) {
      in[i] = input.charAt(i);
      if (in[i] == '1') {
        in[i] = 9;
      } else if (in[i] == '9') {
        in[i] = 1;
      }
    }

    int ans = in[0] * 100 + in[1] * 10 + in[2];
    System.out.println(ans);
  } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String input = sc.next(); input sc.next() sc.next sc char in[] = new char[3]; in new char[3] 3 for (int i = 0; i < 3; i++) {
      in[i] = input.charAt(i);
      if (in[i] == '1') {
        in[i] = 9;
      } else if (in[i] == '9') {
        in[i] = 1;
      }
    } int i = 0; int i = 0; i 0 i < 3 i 3 i++ i++ i {
      in[i] = input.charAt(i);
      if (in[i] == '1') {
        in[i] = 9;
      } else if (in[i] == '9') {
        in[i] = 1;
      }
    } {
      in[i] = input.charAt(i);
      if (in[i] == '1') {
        in[i] = 9;
      } else if (in[i] == '9') {
        in[i] = 1;
      }
    } in[i] = input.charAt(i) in[i] in i input.charAt(i) input.charAt input i if (in[i] == '1') {
        in[i] = 9;
      } else if (in[i] == '9') {
        in[i] = 1;
      } in[i] == '1' in[i] in i '1' {
        in[i] = 9;
      } in[i] = 9 in[i] in i 9 if (in[i] == '9') {
        in[i] = 1;
      } in[i] == '9' in[i] in i '9' {
        in[i] = 1;
      } in[i] = 1 in[i] in i 1 int ans = in[0] * 100 + in[1] * 10 + in[2]; ans in[0] * 100 + in[1] * 10 + in[2] in[0] * 100 + in[1] * 10 + in[2] in[0] * 100 in[0] in 0 100 in[1] * 10 in[1] in 1 10 in[2] in 2 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 sc = new Scanner(System.in);

    String input = sc.next();
    char in[] = new char[3];
    for (int i = 0; i < 3; i++) {
      in[i] = input.charAt(i);
      if (in[i] == '1') {
        in[i] = 9;
      } else if (in[i] == '9') {
        in[i] = 1;
      }
    }

    int ans = in[0] * 100 + in[1] * 10 + in[2];
    System.out.println(ans);
  }
} public class Main {

  public static void main(String[] args) {

    Scanner sc = new Scanner(System.in);

    String input = sc.next();
    char in[] = new char[3];
    for (int i = 0; i < 3; i++) {
      in[i] = input.charAt(i);
      if (in[i] == '1') {
        in[i] = 9;
      } else if (in[i] == '9') {
        in[i] = 1;
      }
    }

    int ans = in[0] * 100 + in[1] * 10 + in[2];
    System.out.println(ans);
  }
} Main
import java.util.Scanner;

public class Main {

  public static void main(String[] args) {

    Scanner sc = new Scanner(System.in);

    String input = sc.next();
    char in[] = new char[3];
    for (int i = 0; i < 3; i++) {
      in[i] = input.charAt(i);
      if (in[i] == '1') {
        in[i] = 9;
      } else if (in[i] == '9') {
        in[i] = 1;
      }
    }

    int ans = in[0] * 100 + in[1] * 10 + in[2];
    System.out.println(ans);
  }
}