import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String num = sc.next();
        String res = "";
        for (char c : num.toCharArray()) {
            if (c == '1') res += "9";
            else if (c == '9') res += "1";
            else res += c;
        }
        System.out.println(res);
    }
} import java.util.Scanner; Scanner java.util public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String num = sc.next();
        String res = "";
        for (char c : num.toCharArray()) {
            if (c == '1') res += "9";
            else if (c == '9') res += "1";
            else res += c;
        }
        System.out.println(res);
    }
} Main public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String num = sc.next();
        String res = "";
        for (char c : num.toCharArray()) {
            if (c == '1') res += "9";
            else if (c == '9') res += "1";
            else res += c;
        }
        System.out.println(res);
    } main {
        Scanner sc = new Scanner(System.in);
        String num = sc.next();
        String res = "";
        for (char c : num.toCharArray()) {
            if (c == '1') res += "9";
            else if (c == '9') res += "1";
            else res += c;
        }
        System.out.println(res);
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String num = sc.next(); num sc.next() sc.next sc String res = ""; res "" for (char c : num.toCharArray()) {
            if (c == '1') res += "9";
            else if (c == '9') res += "1";
            else res += c;
        } char c num.toCharArray() num.toCharArray num {
            if (c == '1') res += "9";
            else if (c == '9') res += "1";
            else res += c;
        } {
            if (c == '1') res += "9";
            else if (c == '9') res += "1";
            else res += c;
        } if (c == '1') res += "9";
            else if (c == '9') res += "1";
            else res += c; c == '1' c '1' res += "9" res "9" if (c == '9') res += "1";
            else res += c; c == '9' c '9' res += "1" res "1" res += c res c System.out.println(res) System.out.println System.out System System.out res String[] args args public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String num = sc.next();
        String res = "";
        for (char c : num.toCharArray()) {
            if (c == '1') res += "9";
            else if (c == '9') res += "1";
            else res += c;
        }
        System.out.println(res);
    }
} public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String num = sc.next();
        String res = "";
        for (char c : num.toCharArray()) {
            if (c == '1') res += "9";
            else if (c == '9') res += "1";
            else res += c;
        }
        System.out.println(res);
    }
} Main
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String num = sc.next();
        String res = "";
        for (char c : num.toCharArray()) {
            if (c == '1') res += "9";
            else if (c == '9') res += "1";
            else res += c;
        }
        System.out.println(res);
    }
}