import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
      int a = n/100;
      int b = n%100/10;
      int c = n%100%10;
      
        if(a==1) System.out.print(9);
        else if(a==9) System.out.print(1);
        else System.out.print(a);
      
      if(b==1) System.out.print(9);
        else if(b==9) System.out.print(1);
        else System.out.print(b);
      
      if(c==1) System.out.print(9);
        else if(c==9) System.out.print(1);
        else System.out.print(c);
      
	}
} import java.util.*; util.* java public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
      int a = n/100;
      int b = n%100/10;
      int c = n%100%10;
      
        if(a==1) System.out.print(9);
        else if(a==9) System.out.print(1);
        else System.out.print(a);
      
      if(b==1) System.out.print(9);
        else if(b==9) System.out.print(1);
        else System.out.print(b);
      
      if(c==1) System.out.print(9);
        else if(c==9) System.out.print(1);
        else System.out.print(c);
      
	}
} Main public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
      int a = n/100;
      int b = n%100/10;
      int c = n%100%10;
      
        if(a==1) System.out.print(9);
        else if(a==9) System.out.print(1);
        else System.out.print(a);
      
      if(b==1) System.out.print(9);
        else if(b==9) System.out.print(1);
        else System.out.print(b);
      
      if(c==1) System.out.print(9);
        else if(c==9) System.out.print(1);
        else System.out.print(c);
      
	} main {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
      int a = n/100;
      int b = n%100/10;
      int c = n%100%10;
      
        if(a==1) System.out.print(9);
        else if(a==9) System.out.print(1);
        else System.out.print(a);
      
      if(b==1) System.out.print(9);
        else if(b==9) System.out.print(1);
        else System.out.print(b);
      
      if(c==1) System.out.print(9);
        else if(c==9) System.out.print(1);
        else System.out.print(c);
      
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int n = sc.nextInt(); n sc.nextInt() sc.nextInt sc int a = n/100; a n/100 n 100 int b = n%100/10; b n%100/10 n%100 n 100 10 int c = n%100%10; c n%100%10 n%100%10 n 100 10 if(a==1) System.out.print(9);
        else if(a==9) System.out.print(1);
        else System.out.print(a); a==1 a 1 System.out.print(9) System.out.print System.out System System.out 9 if(a==9) System.out.print(1);
        else System.out.print(a); a==9 a 9 System.out.print(1) System.out.print System.out System System.out 1 System.out.print(a) System.out.print System.out System System.out a if(b==1) System.out.print(9);
        else if(b==9) System.out.print(1);
        else System.out.print(b); b==1 b 1 System.out.print(9) System.out.print System.out System System.out 9 if(b==9) System.out.print(1);
        else System.out.print(b); b==9 b 9 System.out.print(1) System.out.print System.out System System.out 1 System.out.print(b) System.out.print System.out System System.out b if(c==1) System.out.print(9);
        else if(c==9) System.out.print(1);
        else System.out.print(c); c==1 c 1 System.out.print(9) System.out.print System.out System System.out 9 if(c==9) System.out.print(1);
        else System.out.print(c); c==9 c 9 System.out.print(1) System.out.print System.out System System.out 1 System.out.print(c) System.out.print System.out System System.out c String[] args args public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
      int a = n/100;
      int b = n%100/10;
      int c = n%100%10;
      
        if(a==1) System.out.print(9);
        else if(a==9) System.out.print(1);
        else System.out.print(a);
      
      if(b==1) System.out.print(9);
        else if(b==9) System.out.print(1);
        else System.out.print(b);
      
      if(c==1) System.out.print(9);
        else if(c==9) System.out.print(1);
        else System.out.print(c);
      
	}
} public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
      int a = n/100;
      int b = n%100/10;
      int c = n%100%10;
      
        if(a==1) System.out.print(9);
        else if(a==9) System.out.print(1);
        else System.out.print(a);
      
      if(b==1) System.out.print(9);
        else if(b==9) System.out.print(1);
        else System.out.print(b);
      
      if(c==1) System.out.print(9);
        else if(c==9) System.out.print(1);
        else System.out.print(c);
      
	}
} Main
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
      int a = n/100;
      int b = n%100/10;
      int c = n%100%10;
      
        if(a==1) System.out.print(9);
        else if(a==9) System.out.print(1);
        else System.out.print(a);
      
      if(b==1) System.out.print(9);
        else if(b==9) System.out.print(1);
        else System.out.print(b);
      
      if(c==1) System.out.print(9);
        else if(c==9) System.out.print(1);
        else System.out.print(c);
      
	}
}