import java.util.Scanner;

class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        char n[] = new char[4];
        n = sc.next().toCharArray();
        sc.close();
        for (int i = 0; i < 3; ++i) {
            if (n[i] == '1') n[i] = '9';
            else if (n[i] == '9') n[i] = '1';
        }
        System.out.print(n);
    }
} import java.util.Scanner; Scanner java.util class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        char n[] = new char[4];
        n = sc.next().toCharArray();
        sc.close();
        for (int i = 0; i < 3; ++i) {
            if (n[i] == '1') n[i] = '9';
            else if (n[i] == '9') n[i] = '1';
        }
        System.out.print(n);
    }
} Main public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        char n[] = new char[4];
        n = sc.next().toCharArray();
        sc.close();
        for (int i = 0; i < 3; ++i) {
            if (n[i] == '1') n[i] = '9';
            else if (n[i] == '9') n[i] = '1';
        }
        System.out.print(n);
    } main {
        Scanner sc = new Scanner(System.in);
        char n[] = new char[4];
        n = sc.next().toCharArray();
        sc.close();
        for (int i = 0; i < 3; ++i) {
            if (n[i] == '1') n[i] = '9';
            else if (n[i] == '9') n[i] = '1';
        }
        System.out.print(n);
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) char n[] = new char[4]; n new char[4] 4 n = sc.next().toCharArray() n sc.next().toCharArray() sc.next().toCharArray sc.next() sc.next sc sc.close() sc.close sc for (int i = 0; i < 3; ++i) {
            if (n[i] == '1') n[i] = '9';
            else if (n[i] == '9') n[i] = '1';
        } int i = 0; int i = 0; i 0 i < 3 i 3 ++i ++i i {
            if (n[i] == '1') n[i] = '9';
            else if (n[i] == '9') n[i] = '1';
        } {
            if (n[i] == '1') n[i] = '9';
            else if (n[i] == '9') n[i] = '1';
        } if (n[i] == '1') n[i] = '9';
            else if (n[i] == '9') n[i] = '1'; n[i] == '1' n[i] n i '1' n[i] = '9' n[i] n i '9' if (n[i] == '9') n[i] = '1'; n[i] == '9' n[i] n i '9' n[i] = '1' n[i] n i '1' System.out.print(n) System.out.print System.out System System.out n String[] args args
import java.util.Scanner;

class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        char n[] = new char[4];
        n = sc.next().toCharArray();
        sc.close();
        for (int i = 0; i < 3; ++i) {
            if (n[i] == '1') n[i] = '9';
            else if (n[i] == '9') n[i] = '1';
        }
        System.out.print(n);
    }
}