
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.util.Scanner;

public class Main {

  public static void main(String[] args) throws FileNotFoundException {

    //Scanner cin = new Scanner(new FileReader("input.txt"));
   Scanner cin = new Scanner (System.in);

    String num = cin.next();
    StringBuffer res = new StringBuffer();
    for (int i=0;i<num.length();i++){
      if (num.charAt(i)=='1') res.append('9');
      else if (num.charAt(i)=='9') res.append('1');
    }
    System.out.println(res.toString());

  }

} import java.io.FileNotFoundException; FileNotFoundException java.io import java.io.FileReader; FileReader java.io import java.util.Scanner; Scanner java.util public class Main {

  public static void main(String[] args) throws FileNotFoundException {

    //Scanner cin = new Scanner(new FileReader("input.txt"));
   Scanner cin = new Scanner (System.in);

    String num = cin.next();
    StringBuffer res = new StringBuffer();
    for (int i=0;i<num.length();i++){
      if (num.charAt(i)=='1') res.append('9');
      else if (num.charAt(i)=='9') res.append('1');
    }
    System.out.println(res.toString());

  }

} Main public static void main(String[] args) throws FileNotFoundException {

    //Scanner cin = new Scanner(new FileReader("input.txt"));
   Scanner cin = new Scanner (System.in);

    String num = cin.next();
    StringBuffer res = new StringBuffer();
    for (int i=0;i<num.length();i++){
      if (num.charAt(i)=='1') res.append('9');
      else if (num.charAt(i)=='9') res.append('1');
    }
    System.out.println(res.toString());

  } main {

    //Scanner cin = new Scanner(new FileReader("input.txt"));
   Scanner cin = new Scanner (System.in);

    String num = cin.next();
    StringBuffer res = new StringBuffer();
    for (int i=0;i<num.length();i++){
      if (num.charAt(i)=='1') res.append('9');
      else if (num.charAt(i)=='9') res.append('1');
    }
    System.out.println(res.toString());

  } Scanner cin = new Scanner (System.in); cin new Scanner (System.in) String num = cin.next(); num cin.next() cin.next cin StringBuffer res = new StringBuffer(); res new StringBuffer() for (int i=0;i<num.length();i++){
      if (num.charAt(i)=='1') res.append('9');
      else if (num.charAt(i)=='9') res.append('1');
    } int i=0; int i=0; i 0 i<num.length() i num.length() num.length num i++ i++ i {
      if (num.charAt(i)=='1') res.append('9');
      else if (num.charAt(i)=='9') res.append('1');
    } {
      if (num.charAt(i)=='1') res.append('9');
      else if (num.charAt(i)=='9') res.append('1');
    } if (num.charAt(i)=='1') res.append('9');
      else if (num.charAt(i)=='9') res.append('1'); num.charAt(i)=='1' num.charAt(i) num.charAt num i '1' res.append('9') res.append res '9' if (num.charAt(i)=='9') res.append('1'); num.charAt(i)=='9' num.charAt(i) num.charAt num i '9' res.append('1') res.append res '1' System.out.println(res.toString()) System.out.println System.out System System.out res.toString() res.toString res String[] args args public class Main {

  public static void main(String[] args) throws FileNotFoundException {

    //Scanner cin = new Scanner(new FileReader("input.txt"));
   Scanner cin = new Scanner (System.in);

    String num = cin.next();
    StringBuffer res = new StringBuffer();
    for (int i=0;i<num.length();i++){
      if (num.charAt(i)=='1') res.append('9');
      else if (num.charAt(i)=='9') res.append('1');
    }
    System.out.println(res.toString());

  }

} public class Main {

  public static void main(String[] args) throws FileNotFoundException {

    //Scanner cin = new Scanner(new FileReader("input.txt"));
   Scanner cin = new Scanner (System.in);

    String num = cin.next();
    StringBuffer res = new StringBuffer();
    for (int i=0;i<num.length();i++){
      if (num.charAt(i)=='1') res.append('9');
      else if (num.charAt(i)=='9') res.append('1');
    }
    System.out.println(res.toString());

  }

} Main

import java.io.FileNotFoundException;
import java.io.FileReader;
import java.util.Scanner;

public class Main {

  public static void main(String[] args) throws FileNotFoundException {

    //Scanner cin = new Scanner(new FileReader("input.txt"));
   Scanner cin = new Scanner (System.in);

    String num = cin.next();
    StringBuffer res = new StringBuffer();
    for (int i=0;i<num.length();i++){
      if (num.charAt(i)=='1') res.append('9');
      else if (num.charAt(i)=='9') res.append('1');
    }
    System.out.println(res.toString());

  }

}