import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = Integer.parseInt(sc.next());

        int a = n / 100;
        if (a == 1){
            a = 9;
        }else if (a == 9){
            a = 1;
        }

        int b = (n / 10) % 10;
        if (b == 1){
            b = 9;
        }else if (b == 9){
            b = 1;
        }

        int c = n % 10;
        if (c == 1){
            c = 9;
        }else if (c == 9){
            c = 1;
        }

        int result = a * 100 + b * 10 + c;
        System.out.println(result);
    }
} import java.util.Scanner; Scanner java.util public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = Integer.parseInt(sc.next());

        int a = n / 100;
        if (a == 1){
            a = 9;
        }else if (a == 9){
            a = 1;
        }

        int b = (n / 10) % 10;
        if (b == 1){
            b = 9;
        }else if (b == 9){
            b = 1;
        }

        int c = n % 10;
        if (c == 1){
            c = 9;
        }else if (c == 9){
            c = 1;
        }

        int result = a * 100 + b * 10 + c;
        System.out.println(result);
    }
} Main public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = Integer.parseInt(sc.next());

        int a = n / 100;
        if (a == 1){
            a = 9;
        }else if (a == 9){
            a = 1;
        }

        int b = (n / 10) % 10;
        if (b == 1){
            b = 9;
        }else if (b == 9){
            b = 1;
        }

        int c = n % 10;
        if (c == 1){
            c = 9;
        }else if (c == 9){
            c = 1;
        }

        int result = a * 100 + b * 10 + c;
        System.out.println(result);
    } main {
        Scanner sc = new Scanner(System.in);
        int n = Integer.parseInt(sc.next());

        int a = n / 100;
        if (a == 1){
            a = 9;
        }else if (a == 9){
            a = 1;
        }

        int b = (n / 10) % 10;
        if (b == 1){
            b = 9;
        }else if (b == 9){
            b = 1;
        }

        int c = n % 10;
        if (c == 1){
            c = 9;
        }else if (c == 9){
            c = 1;
        }

        int result = a * 100 + b * 10 + c;
        System.out.println(result);
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int n = Integer.parseInt(sc.next()); n Integer.parseInt(sc.next()) Integer.parseInt Integer sc.next() sc.next sc int a = n / 100; a n / 100 n 100 if (a == 1){
            a = 9;
        }else if (a == 9){
            a = 1;
        } a == 1 a 1 {
            a = 9;
        } a = 9 a 9 if (a == 9){
            a = 1;
        } a == 9 a 9 {
            a = 1;
        } a = 1 a 1 int b = (n / 10) % 10; b (n / 10) % 10 (n / 10) n 10 10 if (b == 1){
            b = 9;
        }else if (b == 9){
            b = 1;
        } b == 1 b 1 {
            b = 9;
        } b = 9 b 9 if (b == 9){
            b = 1;
        } b == 9 b 9 {
            b = 1;
        } b = 1 b 1 int c = n % 10; c n % 10 n 10 if (c == 1){
            c = 9;
        }else if (c == 9){
            c = 1;
        } c == 1 c 1 {
            c = 9;
        } c = 9 c 9 if (c == 9){
            c = 1;
        } c == 9 c 9 {
            c = 1;
        } c = 1 c 1 int result = a * 100 + b * 10 + c; result a * 100 + b * 10 + c a * 100 + b * 10 + c a * 100 a 100 b * 10 b 10 c System.out.println(result) System.out.println System.out System System.out result String[] args args public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = Integer.parseInt(sc.next());

        int a = n / 100;
        if (a == 1){
            a = 9;
        }else if (a == 9){
            a = 1;
        }

        int b = (n / 10) % 10;
        if (b == 1){
            b = 9;
        }else if (b == 9){
            b = 1;
        }

        int c = n % 10;
        if (c == 1){
            c = 9;
        }else if (c == 9){
            c = 1;
        }

        int result = a * 100 + b * 10 + c;
        System.out.println(result);
    }
} public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = Integer.parseInt(sc.next());

        int a = n / 100;
        if (a == 1){
            a = 9;
        }else if (a == 9){
            a = 1;
        }

        int b = (n / 10) % 10;
        if (b == 1){
            b = 9;
        }else if (b == 9){
            b = 1;
        }

        int c = n % 10;
        if (c == 1){
            c = 9;
        }else if (c == 9){
            c = 1;
        }

        int result = a * 100 + b * 10 + c;
        System.out.println(result);
    }
} Main
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = Integer.parseInt(sc.next());

        int a = n / 100;
        if (a == 1){
            a = 9;
        }else if (a == 9){
            a = 1;
        }

        int b = (n / 10) % 10;
        if (b == 1){
            b = 9;
        }else if (b == 9){
            b = 1;
        }

        int c = n % 10;
        if (c == 1){
            c = 9;
        }else if (c == 9){
            c = 1;
        }

        int result = a * 100 + b * 10 + c;
        System.out.println(result);
    }
}