import java.util.*;

public class Main{
  public static void main(String[] args) {
    Scanner sc=new Scanner(System.in);
    String n=sc.next();
    if(n.charAt(0)=='1') System.out.print(9);
    if(n.charAt(0)=='9') System.out.print(1);

    if(n.charAt(1)=='1') System.out.print(9);
    if(n.charAt(1)=='9') System.out.print(1);

    if(n.charAt(2)=='1') System.out.print(9);
    if(n.charAt(2)=='9') System.out.print(1);

    System.out.println();

  }
} import java.util.*; util.* java public class Main{
  public static void main(String[] args) {
    Scanner sc=new Scanner(System.in);
    String n=sc.next();
    if(n.charAt(0)=='1') System.out.print(9);
    if(n.charAt(0)=='9') System.out.print(1);

    if(n.charAt(1)=='1') System.out.print(9);
    if(n.charAt(1)=='9') System.out.print(1);

    if(n.charAt(2)=='1') System.out.print(9);
    if(n.charAt(2)=='9') System.out.print(1);

    System.out.println();

  }
} Main public static void main(String[] args) {
    Scanner sc=new Scanner(System.in);
    String n=sc.next();
    if(n.charAt(0)=='1') System.out.print(9);
    if(n.charAt(0)=='9') System.out.print(1);

    if(n.charAt(1)=='1') System.out.print(9);
    if(n.charAt(1)=='9') System.out.print(1);

    if(n.charAt(2)=='1') System.out.print(9);
    if(n.charAt(2)=='9') System.out.print(1);

    System.out.println();

  } main {
    Scanner sc=new Scanner(System.in);
    String n=sc.next();
    if(n.charAt(0)=='1') System.out.print(9);
    if(n.charAt(0)=='9') System.out.print(1);

    if(n.charAt(1)=='1') System.out.print(9);
    if(n.charAt(1)=='9') System.out.print(1);

    if(n.charAt(2)=='1') System.out.print(9);
    if(n.charAt(2)=='9') System.out.print(1);

    System.out.println();

  } Scanner sc=new Scanner(System.in); sc new Scanner(System.in) String n=sc.next(); n sc.next() sc.next sc if(n.charAt(0)=='1') System.out.print(9); n.charAt(0)=='1' n.charAt(0) n.charAt n 0 '1' System.out.print(9) System.out.print System.out System System.out 9 if(n.charAt(0)=='9') System.out.print(1); n.charAt(0)=='9' n.charAt(0) n.charAt n 0 '9' System.out.print(1) System.out.print System.out System System.out 1 if(n.charAt(1)=='1') System.out.print(9); n.charAt(1)=='1' n.charAt(1) n.charAt n 1 '1' System.out.print(9) System.out.print System.out System System.out 9 if(n.charAt(1)=='9') System.out.print(1); n.charAt(1)=='9' n.charAt(1) n.charAt n 1 '9' System.out.print(1) System.out.print System.out System System.out 1 if(n.charAt(2)=='1') System.out.print(9); n.charAt(2)=='1' n.charAt(2) n.charAt n 2 '1' System.out.print(9) System.out.print System.out System System.out 9 if(n.charAt(2)=='9') System.out.print(1); n.charAt(2)=='9' n.charAt(2) n.charAt n 2 '9' System.out.print(1) System.out.print System.out System System.out 1 System.out.println() System.out.println System.out System System.out String[] args args public class Main{
  public static void main(String[] args) {
    Scanner sc=new Scanner(System.in);
    String n=sc.next();
    if(n.charAt(0)=='1') System.out.print(9);
    if(n.charAt(0)=='9') System.out.print(1);

    if(n.charAt(1)=='1') System.out.print(9);
    if(n.charAt(1)=='9') System.out.print(1);

    if(n.charAt(2)=='1') System.out.print(9);
    if(n.charAt(2)=='9') System.out.print(1);

    System.out.println();

  }
} public class Main{
  public static void main(String[] args) {
    Scanner sc=new Scanner(System.in);
    String n=sc.next();
    if(n.charAt(0)=='1') System.out.print(9);
    if(n.charAt(0)=='9') System.out.print(1);

    if(n.charAt(1)=='1') System.out.print(9);
    if(n.charAt(1)=='9') System.out.print(1);

    if(n.charAt(2)=='1') System.out.print(9);
    if(n.charAt(2)=='9') System.out.print(1);

    System.out.println();

  }
} Main
import java.util.*;

public class Main{
  public static void main(String[] args) {
    Scanner sc=new Scanner(System.in);
    String n=sc.next();
    if(n.charAt(0)=='1') System.out.print(9);
    if(n.charAt(0)=='9') System.out.print(1);

    if(n.charAt(1)=='1') System.out.print(9);
    if(n.charAt(1)=='9') System.out.print(1);

    if(n.charAt(2)=='1') System.out.print(9);
    if(n.charAt(2)=='9') System.out.print(1);

    System.out.println();

  }
}
