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

public class Main {
    public static void main(String[] args) {

        Scanner scanner = new Scanner(System.in);
        PrintWriter out = new PrintWriter(System.out);

        int a = scanner.nextInt();
        int b=0;
        int len = String.valueOf(a).length();
        ArrayList<Integer> list = new ArrayList<>();
        int d = (int)Math.pow(10, len - 1);

        for (int i = 1; i <= len; i++) {
            list.add(a/d);
            a %= d;
            d /= 10;
        }

        for(int i = 1; i <= len; i++) {
            int buf = list.get(i-1);
            if(buf==9){
                buf=1;
            }else if(buf==1){
                buf=9;
            }
            b += buf*(int)Math.pow(10,len-i);
        }
        
        out.println(b);
        out.flush();
    }
} import java.io.PrintWriter; PrintWriter java.io import java.util.*; util.* java public class Main {
    public static void main(String[] args) {

        Scanner scanner = new Scanner(System.in);
        PrintWriter out = new PrintWriter(System.out);

        int a = scanner.nextInt();
        int b=0;
        int len = String.valueOf(a).length();
        ArrayList<Integer> list = new ArrayList<>();
        int d = (int)Math.pow(10, len - 1);

        for (int i = 1; i <= len; i++) {
            list.add(a/d);
            a %= d;
            d /= 10;
        }

        for(int i = 1; i <= len; i++) {
            int buf = list.get(i-1);
            if(buf==9){
                buf=1;
            }else if(buf==1){
                buf=9;
            }
            b += buf*(int)Math.pow(10,len-i);
        }
        
        out.println(b);
        out.flush();
    }
} Main public static void main(String[] args) {

        Scanner scanner = new Scanner(System.in);
        PrintWriter out = new PrintWriter(System.out);

        int a = scanner.nextInt();
        int b=0;
        int len = String.valueOf(a).length();
        ArrayList<Integer> list = new ArrayList<>();
        int d = (int)Math.pow(10, len - 1);

        for (int i = 1; i <= len; i++) {
            list.add(a/d);
            a %= d;
            d /= 10;
        }

        for(int i = 1; i <= len; i++) {
            int buf = list.get(i-1);
            if(buf==9){
                buf=1;
            }else if(buf==1){
                buf=9;
            }
            b += buf*(int)Math.pow(10,len-i);
        }
        
        out.println(b);
        out.flush();
    } main {

        Scanner scanner = new Scanner(System.in);
        PrintWriter out = new PrintWriter(System.out);

        int a = scanner.nextInt();
        int b=0;
        int len = String.valueOf(a).length();
        ArrayList<Integer> list = new ArrayList<>();
        int d = (int)Math.pow(10, len - 1);

        for (int i = 1; i <= len; i++) {
            list.add(a/d);
            a %= d;
            d /= 10;
        }

        for(int i = 1; i <= len; i++) {
            int buf = list.get(i-1);
            if(buf==9){
                buf=1;
            }else if(buf==1){
                buf=9;
            }
            b += buf*(int)Math.pow(10,len-i);
        }
        
        out.println(b);
        out.flush();
    } Scanner scanner = new Scanner(System.in); scanner new Scanner(System.in) PrintWriter out = new PrintWriter(System.out); out new PrintWriter(System.out) int a = scanner.nextInt(); a scanner.nextInt() scanner.nextInt scanner int b=0; b 0 int len = String.valueOf(a).length(); len String.valueOf(a).length() String.valueOf(a).length String.valueOf(a) String.valueOf String a ArrayList<Integer> list = new ArrayList<>(); list new ArrayList<>() int d = (int)Math.pow(10, len - 1); d (int)Math.pow(10, len - 1) Math.pow Math 10 len - 1 len 1 for (int i = 1; i <= len; i++) {
            list.add(a/d);
            a %= d;
            d /= 10;
        } int i = 1; int i = 1; i 1 i <= len i len i++ i++ i {
            list.add(a/d);
            a %= d;
            d /= 10;
        } {
            list.add(a/d);
            a %= d;
            d /= 10;
        } list.add(a/d) list.add list a/d a d a %= d a d d /= 10 d 10 for(int i = 1; i <= len; i++) {
            int buf = list.get(i-1);
            if(buf==9){
                buf=1;
            }else if(buf==1){
                buf=9;
            }
            b += buf*(int)Math.pow(10,len-i);
        } int i = 1; int i = 1; i 1 i <= len i len i++ i++ i {
            int buf = list.get(i-1);
            if(buf==9){
                buf=1;
            }else if(buf==1){
                buf=9;
            }
            b += buf*(int)Math.pow(10,len-i);
        } {
            int buf = list.get(i-1);
            if(buf==9){
                buf=1;
            }else if(buf==1){
                buf=9;
            }
            b += buf*(int)Math.pow(10,len-i);
        } int buf = list.get(i-1); buf list.get(i-1) list.get list i-1 i 1 if(buf==9){
                buf=1;
            }else if(buf==1){
                buf=9;
            } buf==9 buf 9 {
                buf=1;
            } buf=1 buf 1 if(buf==1){
                buf=9;
            } buf==1 buf 1 {
                buf=9;
            } buf=9 buf 9 b += buf*(int)Math.pow(10,len-i) b buf*(int)Math.pow(10,len-i) buf (int)Math.pow(10,len-i) Math.pow Math 10 len-i len i out.println(b) out.println out b out.flush() out.flush out String[] args args public class Main {
    public static void main(String[] args) {

        Scanner scanner = new Scanner(System.in);
        PrintWriter out = new PrintWriter(System.out);

        int a = scanner.nextInt();
        int b=0;
        int len = String.valueOf(a).length();
        ArrayList<Integer> list = new ArrayList<>();
        int d = (int)Math.pow(10, len - 1);

        for (int i = 1; i <= len; i++) {
            list.add(a/d);
            a %= d;
            d /= 10;
        }

        for(int i = 1; i <= len; i++) {
            int buf = list.get(i-1);
            if(buf==9){
                buf=1;
            }else if(buf==1){
                buf=9;
            }
            b += buf*(int)Math.pow(10,len-i);
        }
        
        out.println(b);
        out.flush();
    }
} public class Main {
    public static void main(String[] args) {

        Scanner scanner = new Scanner(System.in);
        PrintWriter out = new PrintWriter(System.out);

        int a = scanner.nextInt();
        int b=0;
        int len = String.valueOf(a).length();
        ArrayList<Integer> list = new ArrayList<>();
        int d = (int)Math.pow(10, len - 1);

        for (int i = 1; i <= len; i++) {
            list.add(a/d);
            a %= d;
            d /= 10;
        }

        for(int i = 1; i <= len; i++) {
            int buf = list.get(i-1);
            if(buf==9){
                buf=1;
            }else if(buf==1){
                buf=9;
            }
            b += buf*(int)Math.pow(10,len-i);
        }
        
        out.println(b);
        out.flush();
    }
} Main
import java.io.PrintWriter;
import java.util.*;

public class Main {
    public static void main(String[] args) {

        Scanner scanner = new Scanner(System.in);
        PrintWriter out = new PrintWriter(System.out);

        int a = scanner.nextInt();
        int b=0;
        int len = String.valueOf(a).length();
        ArrayList<Integer> list = new ArrayList<>();
        int d = (int)Math.pow(10, len - 1);

        for (int i = 1; i <= len; i++) {
            list.add(a/d);
            a %= d;
            d /= 10;
        }

        for(int i = 1; i <= len; i++) {
            int buf = list.get(i-1);
            if(buf==9){
                buf=1;
            }else if(buf==1){
                buf=9;
            }
            b += buf*(int)Math.pow(10,len-i);
        }
        
        out.println(b);
        out.flush();
    }
}
