import java.util.*;
public class Main{
	public static void main(String[] args){
    	Scanner sc = new Scanner(System.in);
      int n = sc.nextInt();
      String str = String.valueOf(n);
      String x1 = str.substring(0,1);
      String x2 = str.substring(1,2);
      String x3 = str.substring(2,3);
      if(x1.equals("1"))x1 = "9";
      else x1 = "1";
      if(x2.equals("1"))x2 = "9";
      else x2 = "1";
      if(x3.equals("1"))x3 = "9";
      else x3 = "1";
      String str1 = x1+x2+x3;
      int n1 = Integer.parseInt(str1);
      System.out.println(n1);
      sc.close();
    }
} import java.util.*; util.* java public class Main{
	public static void main(String[] args){
    	Scanner sc = new Scanner(System.in);
      int n = sc.nextInt();
      String str = String.valueOf(n);
      String x1 = str.substring(0,1);
      String x2 = str.substring(1,2);
      String x3 = str.substring(2,3);
      if(x1.equals("1"))x1 = "9";
      else x1 = "1";
      if(x2.equals("1"))x2 = "9";
      else x2 = "1";
      if(x3.equals("1"))x3 = "9";
      else x3 = "1";
      String str1 = x1+x2+x3;
      int n1 = Integer.parseInt(str1);
      System.out.println(n1);
      sc.close();
    }
} Main public static void main(String[] args){
    	Scanner sc = new Scanner(System.in);
      int n = sc.nextInt();
      String str = String.valueOf(n);
      String x1 = str.substring(0,1);
      String x2 = str.substring(1,2);
      String x3 = str.substring(2,3);
      if(x1.equals("1"))x1 = "9";
      else x1 = "1";
      if(x2.equals("1"))x2 = "9";
      else x2 = "1";
      if(x3.equals("1"))x3 = "9";
      else x3 = "1";
      String str1 = x1+x2+x3;
      int n1 = Integer.parseInt(str1);
      System.out.println(n1);
      sc.close();
    } main {
    	Scanner sc = new Scanner(System.in);
      int n = sc.nextInt();
      String str = String.valueOf(n);
      String x1 = str.substring(0,1);
      String x2 = str.substring(1,2);
      String x3 = str.substring(2,3);
      if(x1.equals("1"))x1 = "9";
      else x1 = "1";
      if(x2.equals("1"))x2 = "9";
      else x2 = "1";
      if(x3.equals("1"))x3 = "9";
      else x3 = "1";
      String str1 = x1+x2+x3;
      int n1 = Integer.parseInt(str1);
      System.out.println(n1);
      sc.close();
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int n = sc.nextInt(); n sc.nextInt() sc.nextInt sc String str = String.valueOf(n); str String.valueOf(n) String.valueOf String n String x1 = str.substring(0,1); x1 str.substring(0,1) str.substring str 0 1 String x2 = str.substring(1,2); x2 str.substring(1,2) str.substring str 1 2 String x3 = str.substring(2,3); x3 str.substring(2,3) str.substring str 2 3 if(x1.equals("1"))x1 = "9";
      else x1 = "1"; x1.equals("1") x1.equals x1 "1" x1 = "9" x1 "9" x1 = "1" x1 "1" if(x2.equals("1"))x2 = "9";
      else x2 = "1"; x2.equals("1") x2.equals x2 "1" x2 = "9" x2 "9" x2 = "1" x2 "1" if(x3.equals("1"))x3 = "9";
      else x3 = "1"; x3.equals("1") x3.equals x3 "1" x3 = "9" x3 "9" x3 = "1" x3 "1" String str1 = x1+x2+x3; str1 x1+x2+x3 x1+x2+x3 x1 x2 x3 int n1 = Integer.parseInt(str1); n1 Integer.parseInt(str1) Integer.parseInt Integer str1 System.out.println(n1) System.out.println System.out System System.out n1 sc.close() sc.close sc String[] args args public class Main{
	public static void main(String[] args){
    	Scanner sc = new Scanner(System.in);
      int n = sc.nextInt();
      String str = String.valueOf(n);
      String x1 = str.substring(0,1);
      String x2 = str.substring(1,2);
      String x3 = str.substring(2,3);
      if(x1.equals("1"))x1 = "9";
      else x1 = "1";
      if(x2.equals("1"))x2 = "9";
      else x2 = "1";
      if(x3.equals("1"))x3 = "9";
      else x3 = "1";
      String str1 = x1+x2+x3;
      int n1 = Integer.parseInt(str1);
      System.out.println(n1);
      sc.close();
    }
} public class Main{
	public static void main(String[] args){
    	Scanner sc = new Scanner(System.in);
      int n = sc.nextInt();
      String str = String.valueOf(n);
      String x1 = str.substring(0,1);
      String x2 = str.substring(1,2);
      String x3 = str.substring(2,3);
      if(x1.equals("1"))x1 = "9";
      else x1 = "1";
      if(x2.equals("1"))x2 = "9";
      else x2 = "1";
      if(x3.equals("1"))x3 = "9";
      else x3 = "1";
      String str1 = x1+x2+x3;
      int n1 = Integer.parseInt(str1);
      System.out.println(n1);
      sc.close();
    }
} Main
import java.util.*;
public class Main{
	public static void main(String[] args){
    	Scanner sc = new Scanner(System.in);
      int n = sc.nextInt();
      String str = String.valueOf(n);
      String x1 = str.substring(0,1);
      String x2 = str.substring(1,2);
      String x3 = str.substring(2,3);
      if(x1.equals("1"))x1 = "9";
      else x1 = "1";
      if(x2.equals("1"))x2 = "9";
      else x2 = "1";
      if(x3.equals("1"))x3 = "9";
      else x3 = "1";
      String str1 = x1+x2+x3;
      int n1 = Integer.parseInt(str1);
      System.out.println(n1);
      sc.close();
    }
}
