import java.util.*;

public class Main {

    long INF = Long.MAX_VALUE;

    public static void main(String[] args) {
        new Main().solve();
    }

    void solve() {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        String[] ans = new String[3];
        for (int i = 0; i < 3; i++) {
            int a = (int) n % (int) Math.pow(10, i + 1) / (int) Math.pow(10, i);
            if (a == 1) {
                ans[3 - i - 1] = "9";
            } else if (a == 9) {
                ans[3 - i - 1] = "1";
            } else {
                ans[3 - i - 1] = String.valueOf(a);
            }
        }
        for (int i = 0; i < 3; i++) {
            System.out.print(ans[i]);
        }
        System.out.println();
    }
} import java.util.*; util.* java public class Main {

    long INF = Long.MAX_VALUE;

    public static void main(String[] args) {
        new Main().solve();
    }

    void solve() {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        String[] ans = new String[3];
        for (int i = 0; i < 3; i++) {
            int a = (int) n % (int) Math.pow(10, i + 1) / (int) Math.pow(10, i);
            if (a == 1) {
                ans[3 - i - 1] = "9";
            } else if (a == 9) {
                ans[3 - i - 1] = "1";
            } else {
                ans[3 - i - 1] = String.valueOf(a);
            }
        }
        for (int i = 0; i < 3; i++) {
            System.out.print(ans[i]);
        }
        System.out.println();
    }
} Main long INF = Long.MAX_VALUE; INF Long.MAX_VALUE Long Long.MAX_VALUE public static void main(String[] args) {
        new Main().solve();
    } main {
        new Main().solve();
    } new Main().solve() new Main().solve new Main() String[] args args void solve() {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        String[] ans = new String[3];
        for (int i = 0; i < 3; i++) {
            int a = (int) n % (int) Math.pow(10, i + 1) / (int) Math.pow(10, i);
            if (a == 1) {
                ans[3 - i - 1] = "9";
            } else if (a == 9) {
                ans[3 - i - 1] = "1";
            } else {
                ans[3 - i - 1] = String.valueOf(a);
            }
        }
        for (int i = 0; i < 3; i++) {
            System.out.print(ans[i]);
        }
        System.out.println();
    } solve {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        String[] ans = new String[3];
        for (int i = 0; i < 3; i++) {
            int a = (int) n % (int) Math.pow(10, i + 1) / (int) Math.pow(10, i);
            if (a == 1) {
                ans[3 - i - 1] = "9";
            } else if (a == 9) {
                ans[3 - i - 1] = "1";
            } else {
                ans[3 - i - 1] = String.valueOf(a);
            }
        }
        for (int i = 0; i < 3; i++) {
            System.out.print(ans[i]);
        }
        System.out.println();
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int n = sc.nextInt(); n sc.nextInt() sc.nextInt sc String[] ans = new String[3]; ans new String[3] 3 for (int i = 0; i < 3; i++) {
            int a = (int) n % (int) Math.pow(10, i + 1) / (int) Math.pow(10, i);
            if (a == 1) {
                ans[3 - i - 1] = "9";
            } else if (a == 9) {
                ans[3 - i - 1] = "1";
            } else {
                ans[3 - i - 1] = String.valueOf(a);
            }
        } int i = 0; int i = 0; i 0 i < 3 i 3 i++ i++ i {
            int a = (int) n % (int) Math.pow(10, i + 1) / (int) Math.pow(10, i);
            if (a == 1) {
                ans[3 - i - 1] = "9";
            } else if (a == 9) {
                ans[3 - i - 1] = "1";
            } else {
                ans[3 - i - 1] = String.valueOf(a);
            }
        } {
            int a = (int) n % (int) Math.pow(10, i + 1) / (int) Math.pow(10, i);
            if (a == 1) {
                ans[3 - i - 1] = "9";
            } else if (a == 9) {
                ans[3 - i - 1] = "1";
            } else {
                ans[3 - i - 1] = String.valueOf(a);
            }
        } int a = (int) n % (int) Math.pow(10, i + 1) / (int) Math.pow(10, i); a (int) n % (int) Math.pow(10, i + 1) / (int) Math.pow(10, i) (int) n % (int) Math.pow(10, i + 1) (int) n (int) Math.pow(10, i + 1) Math.pow Math 10 i + 1 i 1 (int) Math.pow(10, i) Math.pow Math 10 i if (a == 1) {
                ans[3 - i - 1] = "9";
            } else if (a == 9) {
                ans[3 - i - 1] = "1";
            } else {
                ans[3 - i - 1] = String.valueOf(a);
            } a == 1 a 1 {
                ans[3 - i - 1] = "9";
            } ans[3 - i - 1] = "9" ans[3 - i - 1] ans 3 - i - 1 3 - i - 1 3 i 1 "9" if (a == 9) {
                ans[3 - i - 1] = "1";
            } else {
                ans[3 - i - 1] = String.valueOf(a);
            } a == 9 a 9 {
                ans[3 - i - 1] = "1";
            } ans[3 - i - 1] = "1" ans[3 - i - 1] ans 3 - i - 1 3 - i - 1 3 i 1 "1" {
                ans[3 - i - 1] = String.valueOf(a);
            } ans[3 - i - 1] = String.valueOf(a) ans[3 - i - 1] ans 3 - i - 1 3 - i - 1 3 i 1 String.valueOf(a) String.valueOf String a for (int i = 0; i < 3; i++) {
            System.out.print(ans[i]);
        } int i = 0; int i = 0; i 0 i < 3 i 3 i++ i++ i {
            System.out.print(ans[i]);
        } {
            System.out.print(ans[i]);
        } System.out.print(ans[i]) System.out.print System.out System System.out ans[i] ans i System.out.println() System.out.println System.out System System.out public class Main {

    long INF = Long.MAX_VALUE;

    public static void main(String[] args) {
        new Main().solve();
    }

    void solve() {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        String[] ans = new String[3];
        for (int i = 0; i < 3; i++) {
            int a = (int) n % (int) Math.pow(10, i + 1) / (int) Math.pow(10, i);
            if (a == 1) {
                ans[3 - i - 1] = "9";
            } else if (a == 9) {
                ans[3 - i - 1] = "1";
            } else {
                ans[3 - i - 1] = String.valueOf(a);
            }
        }
        for (int i = 0; i < 3; i++) {
            System.out.print(ans[i]);
        }
        System.out.println();
    }
} public class Main {

    long INF = Long.MAX_VALUE;

    public static void main(String[] args) {
        new Main().solve();
    }

    void solve() {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        String[] ans = new String[3];
        for (int i = 0; i < 3; i++) {
            int a = (int) n % (int) Math.pow(10, i + 1) / (int) Math.pow(10, i);
            if (a == 1) {
                ans[3 - i - 1] = "9";
            } else if (a == 9) {
                ans[3 - i - 1] = "1";
            } else {
                ans[3 - i - 1] = String.valueOf(a);
            }
        }
        for (int i = 0; i < 3; i++) {
            System.out.print(ans[i]);
        }
        System.out.println();
    }
} Main
import java.util.*;

public class Main {

    long INF = Long.MAX_VALUE;

    public static void main(String[] args) {
        new Main().solve();
    }

    void solve() {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        String[] ans = new String[3];
        for (int i = 0; i < 3; i++) {
            int a = (int) n % (int) Math.pow(10, i + 1) / (int) Math.pow(10, i);
            if (a == 1) {
                ans[3 - i - 1] = "9";
            } else if (a == 9) {
                ans[3 - i - 1] = "1";
            } else {
                ans[3 - i - 1] = String.valueOf(a);
            }
        }
        for (int i = 0; i < 3; i++) {
            System.out.print(ans[i]);
        }
        System.out.println();
    }
}