import java.util.Scanner;
import java.util.*;
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] num = new int[3];
        for (int i = 0; i < 3; i++) {
            int x = n % 10;
            n /= 10;
            if (x == 9) {
                num[i] = 1;
                continue;
            }
            if (x == 1) {
                num[i] = 9;
                continue;
            }
        }
        System.out.println(num[2] * 100 + num[1] * 10 + num[0]);
    }
} import java.util.Scanner; Scanner java.util import java.util.*; util.* java public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] num = new int[3];
        for (int i = 0; i < 3; i++) {
            int x = n % 10;
            n /= 10;
            if (x == 9) {
                num[i] = 1;
                continue;
            }
            if (x == 1) {
                num[i] = 9;
                continue;
            }
        }
        System.out.println(num[2] * 100 + num[1] * 10 + num[0]);
    }
} Main public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] num = new int[3];
        for (int i = 0; i < 3; i++) {
            int x = n % 10;
            n /= 10;
            if (x == 9) {
                num[i] = 1;
                continue;
            }
            if (x == 1) {
                num[i] = 9;
                continue;
            }
        }
        System.out.println(num[2] * 100 + num[1] * 10 + num[0]);
    } main {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] num = new int[3];
        for (int i = 0; i < 3; i++) {
            int x = n % 10;
            n /= 10;
            if (x == 9) {
                num[i] = 1;
                continue;
            }
            if (x == 1) {
                num[i] = 9;
                continue;
            }
        }
        System.out.println(num[2] * 100 + num[1] * 10 + num[0]);
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int n = sc.nextInt(); n sc.nextInt() sc.nextInt sc int[] num = new int[3]; num new int[3] 3 for (int i = 0; i < 3; i++) {
            int x = n % 10;
            n /= 10;
            if (x == 9) {
                num[i] = 1;
                continue;
            }
            if (x == 1) {
                num[i] = 9;
                continue;
            }
        } int i = 0; int i = 0; i 0 i < 3 i 3 i++ i++ i {
            int x = n % 10;
            n /= 10;
            if (x == 9) {
                num[i] = 1;
                continue;
            }
            if (x == 1) {
                num[i] = 9;
                continue;
            }
        } {
            int x = n % 10;
            n /= 10;
            if (x == 9) {
                num[i] = 1;
                continue;
            }
            if (x == 1) {
                num[i] = 9;
                continue;
            }
        } int x = n % 10; x n % 10 n 10 n /= 10 n 10 if (x == 9) {
                num[i] = 1;
                continue;
            } x == 9 x 9 {
                num[i] = 1;
                continue;
            } num[i] = 1 num[i] num i 1 continue; if (x == 1) {
                num[i] = 9;
                continue;
            } x == 1 x 1 {
                num[i] = 9;
                continue;
            } num[i] = 9 num[i] num i 9 continue; System.out.println(num[2] * 100 + num[1] * 10 + num[0]) System.out.println System.out System System.out num[2] * 100 + num[1] * 10 + num[0] num[2] * 100 + num[1] * 10 + num[0] num[2] * 100 num[2] num 2 100 num[1] * 10 num[1] num 1 10 num[0] num 0 String[] args args public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] num = new int[3];
        for (int i = 0; i < 3; i++) {
            int x = n % 10;
            n /= 10;
            if (x == 9) {
                num[i] = 1;
                continue;
            }
            if (x == 1) {
                num[i] = 9;
                continue;
            }
        }
        System.out.println(num[2] * 100 + num[1] * 10 + num[0]);
    }
} public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] num = new int[3];
        for (int i = 0; i < 3; i++) {
            int x = n % 10;
            n /= 10;
            if (x == 9) {
                num[i] = 1;
                continue;
            }
            if (x == 1) {
                num[i] = 9;
                continue;
            }
        }
        System.out.println(num[2] * 100 + num[1] * 10 + num[0]);
    }
} Main
import java.util.Scanner;
import java.util.*;
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] num = new int[3];
        for (int i = 0; i < 3; i++) {
            int x = n % 10;
            n /= 10;
            if (x == 9) {
                num[i] = 1;
                continue;
            }
            if (x == 1) {
                num[i] = 9;
                continue;
            }
        }
        System.out.println(num[2] * 100 + num[1] * 10 + num[0]);
    }
}
