import java.util.*;
public class Main{
    public static void main(String []args){
        Scanner x=new Scanner(System.in);
        int a=x.nextInt();
        int ans=0;
        while(111<=a&&a<=999){
            int b=a/100;
            int c=a%100/10;
            int d=a%100%10/1;
            ans=(10-b)*100+(10-c)*10+(10-d);
            break;
        }
        System.out.println(ans);
     }
} import java.util.*; util.* java public class Main{
    public static void main(String []args){
        Scanner x=new Scanner(System.in);
        int a=x.nextInt();
        int ans=0;
        while(111<=a&&a<=999){
            int b=a/100;
            int c=a%100/10;
            int d=a%100%10/1;
            ans=(10-b)*100+(10-c)*10+(10-d);
            break;
        }
        System.out.println(ans);
     }
} Main public static void main(String []args){
        Scanner x=new Scanner(System.in);
        int a=x.nextInt();
        int ans=0;
        while(111<=a&&a<=999){
            int b=a/100;
            int c=a%100/10;
            int d=a%100%10/1;
            ans=(10-b)*100+(10-c)*10+(10-d);
            break;
        }
        System.out.println(ans);
     } main {
        Scanner x=new Scanner(System.in);
        int a=x.nextInt();
        int ans=0;
        while(111<=a&&a<=999){
            int b=a/100;
            int c=a%100/10;
            int d=a%100%10/1;
            ans=(10-b)*100+(10-c)*10+(10-d);
            break;
        }
        System.out.println(ans);
     } Scanner x=new Scanner(System.in); x new Scanner(System.in) int a=x.nextInt(); a x.nextInt() x.nextInt x int ans=0; ans 0 while(111<=a&&a<=999){
            int b=a/100;
            int c=a%100/10;
            int d=a%100%10/1;
            ans=(10-b)*100+(10-c)*10+(10-d);
            break;
        } 111<=a&&a<=999 111<=a 111 a a<=999 a 999 {
            int b=a/100;
            int c=a%100/10;
            int d=a%100%10/1;
            ans=(10-b)*100+(10-c)*10+(10-d);
            break;
        } int b=a/100; b a/100 a 100 int c=a%100/10; c a%100/10 a%100 a 100 10 int d=a%100%10/1; d a%100%10/1 a%100%10 a%100%10 a 100 10 1 ans=(10-b)*100+(10-c)*10+(10-d) ans (10-b)*100+(10-c)*10+(10-d) (10-b)*100+(10-c)*10+(10-d) (10-b)*100 (10-b) 10 b 100 (10-c)*10 (10-c) 10 c 10 (10-d) 10 d break; System.out.println(ans) System.out.println System.out System System.out ans String []args args public class Main{
    public static void main(String []args){
        Scanner x=new Scanner(System.in);
        int a=x.nextInt();
        int ans=0;
        while(111<=a&&a<=999){
            int b=a/100;
            int c=a%100/10;
            int d=a%100%10/1;
            ans=(10-b)*100+(10-c)*10+(10-d);
            break;
        }
        System.out.println(ans);
     }
} public class Main{
    public static void main(String []args){
        Scanner x=new Scanner(System.in);
        int a=x.nextInt();
        int ans=0;
        while(111<=a&&a<=999){
            int b=a/100;
            int c=a%100/10;
            int d=a%100%10/1;
            ans=(10-b)*100+(10-c)*10+(10-d);
            break;
        }
        System.out.println(ans);
     }
} Main
import java.util.*;
public class Main{
    public static void main(String []args){
        Scanner x=new Scanner(System.in);
        int a=x.nextInt();
        int ans=0;
        while(111<=a&&a<=999){
            int b=a/100;
            int c=a%100/10;
            int d=a%100%10/1;
            ans=(10-b)*100+(10-c)*10+(10-d);
            break;
        }
        System.out.println(ans);
     }
}