import java.util.*;

public class Main {

    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);
        String n = sc.next();

        String r = "";
        for (char c : n.toCharArray()) {
            r += solve(c);
        }
        System.out.print(r);

    }

    static char solve (char c){
        switch (c) {
            case '1':
                return '9';
            case '9':
                return '1';
            default:
                return c;
        }
    }
} import java.util.*; util.* java public class Main {

    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);
        String n = sc.next();

        String r = "";
        for (char c : n.toCharArray()) {
            r += solve(c);
        }
        System.out.print(r);

    }

    static char solve (char c){
        switch (c) {
            case '1':
                return '9';
            case '9':
                return '1';
            default:
                return c;
        }
    }
} Main public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);
        String n = sc.next();

        String r = "";
        for (char c : n.toCharArray()) {
            r += solve(c);
        }
        System.out.print(r);

    } main {

        Scanner sc = new Scanner(System.in);
        String n = sc.next();

        String r = "";
        for (char c : n.toCharArray()) {
            r += solve(c);
        }
        System.out.print(r);

    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String n = sc.next(); n sc.next() sc.next sc String r = ""; r "" for (char c : n.toCharArray()) {
            r += solve(c);
        } char c n.toCharArray() n.toCharArray n {
            r += solve(c);
        } {
            r += solve(c);
        } r += solve(c) r solve(c) solve c System.out.print(r) System.out.print System.out System System.out r String[] args args static char solve (char c){
        switch (c) {
            case '1':
                return '9';
            case '9':
                return '1';
            default:
                return c;
        }
    } solve {
        switch (c) {
            case '1':
                return '9';
            case '9':
                return '1';
            default:
                return c;
        }
    } switch (c) {
            case '1':
                return '9';
            case '9':
                return '1';
            default:
                return c;
        } c case '1': '1' case '1': return '9'; '9' case '9': '9' case '9': return '1'; '1' default: default: return c; c char c c public class Main {

    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);
        String n = sc.next();

        String r = "";
        for (char c : n.toCharArray()) {
            r += solve(c);
        }
        System.out.print(r);

    }

    static char solve (char c){
        switch (c) {
            case '1':
                return '9';
            case '9':
                return '1';
            default:
                return c;
        }
    }
} public class Main {

    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);
        String n = sc.next();

        String r = "";
        for (char c : n.toCharArray()) {
            r += solve(c);
        }
        System.out.print(r);

    }

    static char solve (char c){
        switch (c) {
            case '1':
                return '9';
            case '9':
                return '1';
            default:
                return c;
        }
    }
} Main
import java.util.*;

public class Main {

    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);
        String n = sc.next();

        String r = "";
        for (char c : n.toCharArray()) {
            r += solve(c);
        }
        System.out.print(r);

    }

    static char solve (char c){
        switch (c) {
            case '1':
                return '9';
            case '9':
                return '1';
            default:
                return c;
        }
    }
}