import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {

  public static void main(String[] args) {
    new Main().run();
  }

  public void run() {
    
    try(BufferedReader in = new BufferedReader(new InputStreamReader(System.in))) {

      String line = in.readLine();

      char[] str = new char[line.length()];
      int i = 0;
      for (char ch : line.toCharArray()) {
        if(ch == '1')
          str[i++] = '9';
        else if (ch == '9')
          str[i++] = '1';
        else
          str[i++] = ch;
      }

      System.out.println(str);
    }
    catch(IOException e) {
      System.err.println(e);
    }
  }
} import java.io.BufferedReader; BufferedReader java.io import java.io.IOException; IOException java.io import java.io.InputStreamReader; InputStreamReader java.io public class Main {

  public static void main(String[] args) {
    new Main().run();
  }

  public void run() {
    
    try(BufferedReader in = new BufferedReader(new InputStreamReader(System.in))) {

      String line = in.readLine();

      char[] str = new char[line.length()];
      int i = 0;
      for (char ch : line.toCharArray()) {
        if(ch == '1')
          str[i++] = '9';
        else if (ch == '9')
          str[i++] = '1';
        else
          str[i++] = ch;
      }

      System.out.println(str);
    }
    catch(IOException e) {
      System.err.println(e);
    }
  }
} Main public static void main(String[] args) {
    new Main().run();
  } main {
    new Main().run();
  } new Main().run() new Main().run new Main() String[] args args public void run() {
    
    try(BufferedReader in = new BufferedReader(new InputStreamReader(System.in))) {

      String line = in.readLine();

      char[] str = new char[line.length()];
      int i = 0;
      for (char ch : line.toCharArray()) {
        if(ch == '1')
          str[i++] = '9';
        else if (ch == '9')
          str[i++] = '1';
        else
          str[i++] = ch;
      }

      System.out.println(str);
    }
    catch(IOException e) {
      System.err.println(e);
    }
  } run {
    
    try(BufferedReader in = new BufferedReader(new InputStreamReader(System.in))) {

      String line = in.readLine();

      char[] str = new char[line.length()];
      int i = 0;
      for (char ch : line.toCharArray()) {
        if(ch == '1')
          str[i++] = '9';
        else if (ch == '9')
          str[i++] = '1';
        else
          str[i++] = ch;
      }

      System.out.println(str);
    }
    catch(IOException e) {
      System.err.println(e);
    }
  } try(BufferedReader in = new BufferedReader(new InputStreamReader(System.in))) {

      String line = in.readLine();

      char[] str = new char[line.length()];
      int i = 0;
      for (char ch : line.toCharArray()) {
        if(ch == '1')
          str[i++] = '9';
        else if (ch == '9')
          str[i++] = '1';
        else
          str[i++] = ch;
      }

      System.out.println(str);
    }
    catch(IOException e) {
      System.err.println(e);
    } catch(IOException e) {
      System.err.println(e);
    } IOException e {
      System.err.println(e);
    } System.err.println(e) System.err.println System.err System System.err e {

      String line = in.readLine();

      char[] str = new char[line.length()];
      int i = 0;
      for (char ch : line.toCharArray()) {
        if(ch == '1')
          str[i++] = '9';
        else if (ch == '9')
          str[i++] = '1';
        else
          str[i++] = ch;
      }

      System.out.println(str);
    } BufferedReader in = new BufferedReader(new InputStreamReader(System.in)) BufferedReader in = new BufferedReader(new InputStreamReader(System.in)) new BufferedReader(new InputStreamReader(System.in)) String line = in.readLine(); line in.readLine() in.readLine in char[] str = new char[line.length()]; str new char[line.length()] line.length() line.length line int i = 0; i 0 for (char ch : line.toCharArray()) {
        if(ch == '1')
          str[i++] = '9';
        else if (ch == '9')
          str[i++] = '1';
        else
          str[i++] = ch;
      } char ch line.toCharArray() line.toCharArray line {
        if(ch == '1')
          str[i++] = '9';
        else if (ch == '9')
          str[i++] = '1';
        else
          str[i++] = ch;
      } {
        if(ch == '1')
          str[i++] = '9';
        else if (ch == '9')
          str[i++] = '1';
        else
          str[i++] = ch;
      } if(ch == '1')
          str[i++] = '9';
        else if (ch == '9')
          str[i++] = '1';
        else
          str[i++] = ch; ch == '1' ch '1' str[i++] = '9' str[i++] str i++ i '9' if (ch == '9')
          str[i++] = '1';
        else
          str[i++] = ch; ch == '9' ch '9' str[i++] = '1' str[i++] str i++ i '1' str[i++] = ch str[i++] str i++ i ch System.out.println(str) System.out.println System.out System System.out str public class Main {

  public static void main(String[] args) {
    new Main().run();
  }

  public void run() {
    
    try(BufferedReader in = new BufferedReader(new InputStreamReader(System.in))) {

      String line = in.readLine();

      char[] str = new char[line.length()];
      int i = 0;
      for (char ch : line.toCharArray()) {
        if(ch == '1')
          str[i++] = '9';
        else if (ch == '9')
          str[i++] = '1';
        else
          str[i++] = ch;
      }

      System.out.println(str);
    }
    catch(IOException e) {
      System.err.println(e);
    }
  }
} public class Main {

  public static void main(String[] args) {
    new Main().run();
  }

  public void run() {
    
    try(BufferedReader in = new BufferedReader(new InputStreamReader(System.in))) {

      String line = in.readLine();

      char[] str = new char[line.length()];
      int i = 0;
      for (char ch : line.toCharArray()) {
        if(ch == '1')
          str[i++] = '9';
        else if (ch == '9')
          str[i++] = '1';
        else
          str[i++] = ch;
      }

      System.out.println(str);
    }
    catch(IOException e) {
      System.err.println(e);
    }
  }
} Main
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {

  public static void main(String[] args) {
    new Main().run();
  }

  public void run() {
    
    try(BufferedReader in = new BufferedReader(new InputStreamReader(System.in))) {

      String line = in.readLine();

      char[] str = new char[line.length()];
      int i = 0;
      for (char ch : line.toCharArray()) {
        if(ch == '1')
          str[i++] = '9';
        else if (ch == '9')
          str[i++] = '1';
        else
          str[i++] = ch;
      }

      System.out.println(str);
    }
    catch(IOException e) {
      System.err.println(e);
    }
  }
}