import java.util.Scanner;

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

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