import java.util.Scanner;
import java.util.StringJoiner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String[] n = sc.next().split("");
        for (int i = 0; i < n.length; i++) {
            if ("1".equals(n[i])) {
                n[i] = "9";
                continue;
            }
            if ("9".equals(n[i])) {
                n[i] = "1";
            }
        }
        StringJoiner sj = new StringJoiner("");
        for (int i = 0; i < n.length; i++) {
            sj.add(n[i]);
        }
        System.out.println(sj.toString());
    }

} import java.util.Scanner; Scanner java.util import java.util.StringJoiner; StringJoiner java.util public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String[] n = sc.next().split("");
        for (int i = 0; i < n.length; i++) {
            if ("1".equals(n[i])) {
                n[i] = "9";
                continue;
            }
            if ("9".equals(n[i])) {
                n[i] = "1";
            }
        }
        StringJoiner sj = new StringJoiner("");
        for (int i = 0; i < n.length; i++) {
            sj.add(n[i]);
        }
        System.out.println(sj.toString());
    }

} Main public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String[] n = sc.next().split("");
        for (int i = 0; i < n.length; i++) {
            if ("1".equals(n[i])) {
                n[i] = "9";
                continue;
            }
            if ("9".equals(n[i])) {
                n[i] = "1";
            }
        }
        StringJoiner sj = new StringJoiner("");
        for (int i = 0; i < n.length; i++) {
            sj.add(n[i]);
        }
        System.out.println(sj.toString());
    } main {
        Scanner sc = new Scanner(System.in);
        String[] n = sc.next().split("");
        for (int i = 0; i < n.length; i++) {
            if ("1".equals(n[i])) {
                n[i] = "9";
                continue;
            }
            if ("9".equals(n[i])) {
                n[i] = "1";
            }
        }
        StringJoiner sj = new StringJoiner("");
        for (int i = 0; i < n.length; i++) {
            sj.add(n[i]);
        }
        System.out.println(sj.toString());
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String[] n = sc.next().split(""); n sc.next().split("") sc.next().split sc.next() sc.next sc "" for (int i = 0; i < n.length; i++) {
            if ("1".equals(n[i])) {
                n[i] = "9";
                continue;
            }
            if ("9".equals(n[i])) {
                n[i] = "1";
            }
        } int i = 0; int i = 0; i 0 i < n.length i n.length n n.length i++ i++ i {
            if ("1".equals(n[i])) {
                n[i] = "9";
                continue;
            }
            if ("9".equals(n[i])) {
                n[i] = "1";
            }
        } {
            if ("1".equals(n[i])) {
                n[i] = "9";
                continue;
            }
            if ("9".equals(n[i])) {
                n[i] = "1";
            }
        } if ("1".equals(n[i])) {
                n[i] = "9";
                continue;
            } "1".equals(n[i]) "1".equals "1" n[i] n i {
                n[i] = "9";
                continue;
            } n[i] = "9" n[i] n i "9" continue; if ("9".equals(n[i])) {
                n[i] = "1";
            } "9".equals(n[i]) "9".equals "9" n[i] n i {
                n[i] = "1";
            } n[i] = "1" n[i] n i "1" StringJoiner sj = new StringJoiner(""); sj new StringJoiner("") for (int i = 0; i < n.length; i++) {
            sj.add(n[i]);
        } int i = 0; int i = 0; i 0 i < n.length i n.length n n.length i++ i++ i {
            sj.add(n[i]);
        } {
            sj.add(n[i]);
        } sj.add(n[i]) sj.add sj n[i] n i System.out.println(sj.toString()) System.out.println System.out System System.out sj.toString() sj.toString sj String[] args args public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String[] n = sc.next().split("");
        for (int i = 0; i < n.length; i++) {
            if ("1".equals(n[i])) {
                n[i] = "9";
                continue;
            }
            if ("9".equals(n[i])) {
                n[i] = "1";
            }
        }
        StringJoiner sj = new StringJoiner("");
        for (int i = 0; i < n.length; i++) {
            sj.add(n[i]);
        }
        System.out.println(sj.toString());
    }

} public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String[] n = sc.next().split("");
        for (int i = 0; i < n.length; i++) {
            if ("1".equals(n[i])) {
                n[i] = "9";
                continue;
            }
            if ("9".equals(n[i])) {
                n[i] = "1";
            }
        }
        StringJoiner sj = new StringJoiner("");
        for (int i = 0; i < n.length; i++) {
            sj.add(n[i]);
        }
        System.out.println(sj.toString());
    }

} Main
import java.util.Scanner;
import java.util.StringJoiner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String[] n = sc.next().split("");
        for (int i = 0; i < n.length; i++) {
            if ("1".equals(n[i])) {
                n[i] = "9";
                continue;
            }
            if ("9".equals(n[i])) {
                n[i] = "1";
            }
        }
        StringJoiner sj = new StringJoiner("");
        for (int i = 0; i < n.length; i++) {
            sj.add(n[i]);
        }
        System.out.println(sj.toString());
    }

}
