import java.util.*;

public class Main {

    static final int MOD = 1000000007;

    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);
        char arr[] = sc.next().toCharArray();
        for(int i=0;i<arr.length;i++){
            if(arr[i]=='9')arr[i]='1';
            else arr[i] = '9';
        }
        for(Character c:arr) System.out.print(c);
        System.out.println();

    }
} import java.util.*; util.* java public class Main {

    static final int MOD = 1000000007;

    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);
        char arr[] = sc.next().toCharArray();
        for(int i=0;i<arr.length;i++){
            if(arr[i]=='9')arr[i]='1';
            else arr[i] = '9';
        }
        for(Character c:arr) System.out.print(c);
        System.out.println();

    }
} Main static final int MOD = 1000000007; MOD 1000000007 public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);
        char arr[] = sc.next().toCharArray();
        for(int i=0;i<arr.length;i++){
            if(arr[i]=='9')arr[i]='1';
            else arr[i] = '9';
        }
        for(Character c:arr) System.out.print(c);
        System.out.println();

    } main {

        Scanner sc = new Scanner(System.in);
        char arr[] = sc.next().toCharArray();
        for(int i=0;i<arr.length;i++){
            if(arr[i]=='9')arr[i]='1';
            else arr[i] = '9';
        }
        for(Character c:arr) System.out.print(c);
        System.out.println();

    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) char arr[] = sc.next().toCharArray(); arr sc.next().toCharArray() sc.next().toCharArray sc.next() sc.next sc for(int i=0;i<arr.length;i++){
            if(arr[i]=='9')arr[i]='1';
            else arr[i] = '9';
        } int i=0; int i=0; i 0 i<arr.length i arr.length arr arr.length i++ i++ i {
            if(arr[i]=='9')arr[i]='1';
            else arr[i] = '9';
        } {
            if(arr[i]=='9')arr[i]='1';
            else arr[i] = '9';
        } if(arr[i]=='9')arr[i]='1';
            else arr[i] = '9'; arr[i]=='9' arr[i] arr i '9' arr[i]='1' arr[i] arr i '1' arr[i] = '9' arr[i] arr i '9' for(Character c:arr) System.out.print(c); Character c arr System.out.print(c); System.out.print(c) System.out.print System.out System System.out c System.out.println() System.out.println System.out System System.out String[] args args public class Main {

    static final int MOD = 1000000007;

    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);
        char arr[] = sc.next().toCharArray();
        for(int i=0;i<arr.length;i++){
            if(arr[i]=='9')arr[i]='1';
            else arr[i] = '9';
        }
        for(Character c:arr) System.out.print(c);
        System.out.println();

    }
} public class Main {

    static final int MOD = 1000000007;

    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);
        char arr[] = sc.next().toCharArray();
        for(int i=0;i<arr.length;i++){
            if(arr[i]=='9')arr[i]='1';
            else arr[i] = '9';
        }
        for(Character c:arr) System.out.print(c);
        System.out.println();

    }
} Main
import java.util.*;

public class Main {

    static final int MOD = 1000000007;

    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);
        char arr[] = sc.next().toCharArray();
        for(int i=0;i<arr.length;i++){
            if(arr[i]=='9')arr[i]='1';
            else arr[i] = '9';
        }
        for(Character c:arr) System.out.print(c);
        System.out.println();

    }
}
