import java.util.*;
import java.io.*;

public class Main{
  public static void main(String[] args){
    Scanner scan = new Scanner(System.in);
    int N = scan.nextInt();
    int value;

    List<Integer>list = new ArrayList<Integer>();

    while(N > 0){
      if(N % 10 == 1)
        value = 9;
      else
        value = 1;
      list.add(value);
      N /= 10;
    }

    for(int i=list.size()-1; i>=0; i--){
      System.out.print(list.get(i));
    }
    System.out.println();

  }
} import java.util.*; util.* java import java.io.*; io.* java public class Main{
  public static void main(String[] args){
    Scanner scan = new Scanner(System.in);
    int N = scan.nextInt();
    int value;

    List<Integer>list = new ArrayList<Integer>();

    while(N > 0){
      if(N % 10 == 1)
        value = 9;
      else
        value = 1;
      list.add(value);
      N /= 10;
    }

    for(int i=list.size()-1; i>=0; i--){
      System.out.print(list.get(i));
    }
    System.out.println();

  }
} Main public static void main(String[] args){
    Scanner scan = new Scanner(System.in);
    int N = scan.nextInt();
    int value;

    List<Integer>list = new ArrayList<Integer>();

    while(N > 0){
      if(N % 10 == 1)
        value = 9;
      else
        value = 1;
      list.add(value);
      N /= 10;
    }

    for(int i=list.size()-1; i>=0; i--){
      System.out.print(list.get(i));
    }
    System.out.println();

  } main {
    Scanner scan = new Scanner(System.in);
    int N = scan.nextInt();
    int value;

    List<Integer>list = new ArrayList<Integer>();

    while(N > 0){
      if(N % 10 == 1)
        value = 9;
      else
        value = 1;
      list.add(value);
      N /= 10;
    }

    for(int i=list.size()-1; i>=0; i--){
      System.out.print(list.get(i));
    }
    System.out.println();

  } Scanner scan = new Scanner(System.in); scan new Scanner(System.in) int N = scan.nextInt(); N scan.nextInt() scan.nextInt scan int value; value List<Integer>list = new ArrayList<Integer>(); list new ArrayList<Integer>() while(N > 0){
      if(N % 10 == 1)
        value = 9;
      else
        value = 1;
      list.add(value);
      N /= 10;
    } N > 0 N 0 {
      if(N % 10 == 1)
        value = 9;
      else
        value = 1;
      list.add(value);
      N /= 10;
    } if(N % 10 == 1)
        value = 9;
      else
        value = 1; N % 10 == 1 N % 10 N 10 1 value = 9 value 9 value = 1 value 1 list.add(value) list.add list value N /= 10 N 10 for(int i=list.size()-1; i>=0; i--){
      System.out.print(list.get(i));
    } int i=list.size()-1; int i=list.size()-1; i list.size()-1 list.size() list.size list 1 i>=0 i 0 i-- i-- i {
      System.out.print(list.get(i));
    } {
      System.out.print(list.get(i));
    } System.out.print(list.get(i)) System.out.print System.out System System.out list.get(i) list.get list i System.out.println() System.out.println System.out System System.out String[] args args public class Main{
  public static void main(String[] args){
    Scanner scan = new Scanner(System.in);
    int N = scan.nextInt();
    int value;

    List<Integer>list = new ArrayList<Integer>();

    while(N > 0){
      if(N % 10 == 1)
        value = 9;
      else
        value = 1;
      list.add(value);
      N /= 10;
    }

    for(int i=list.size()-1; i>=0; i--){
      System.out.print(list.get(i));
    }
    System.out.println();

  }
} public class Main{
  public static void main(String[] args){
    Scanner scan = new Scanner(System.in);
    int N = scan.nextInt();
    int value;

    List<Integer>list = new ArrayList<Integer>();

    while(N > 0){
      if(N % 10 == 1)
        value = 9;
      else
        value = 1;
      list.add(value);
      N /= 10;
    }

    for(int i=list.size()-1; i>=0; i--){
      System.out.print(list.get(i));
    }
    System.out.println();

  }
} Main
import java.util.*;
import java.io.*;

public class Main{
  public static void main(String[] args){
    Scanner scan = new Scanner(System.in);
    int N = scan.nextInt();
    int value;

    List<Integer>list = new ArrayList<Integer>();

    while(N > 0){
      if(N % 10 == 1)
        value = 9;
      else
        value = 1;
      list.add(value);
      N /= 10;
    }

    for(int i=list.size()-1; i>=0; i--){
      System.out.print(list.get(i));
    }
    System.out.println();

  }
}
