import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        String s = String.valueOf(n);
        s = s.replaceAll("1","a");
        s = s.replaceAll("9","b");
        s = s.replaceAll("a","9");
        s = s.replaceAll("b","1");
        System.out.println(s);
    }
} import java.util.*; util.* java public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        String s = String.valueOf(n);
        s = s.replaceAll("1","a");
        s = s.replaceAll("9","b");
        s = s.replaceAll("a","9");
        s = s.replaceAll("b","1");
        System.out.println(s);
    }
} Main public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        String s = String.valueOf(n);
        s = s.replaceAll("1","a");
        s = s.replaceAll("9","b");
        s = s.replaceAll("a","9");
        s = s.replaceAll("b","1");
        System.out.println(s);
    } main {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        String s = String.valueOf(n);
        s = s.replaceAll("1","a");
        s = s.replaceAll("9","b");
        s = s.replaceAll("a","9");
        s = s.replaceAll("b","1");
        System.out.println(s);
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int n = sc.nextInt(); n sc.nextInt() sc.nextInt sc String s = String.valueOf(n); s String.valueOf(n) String.valueOf String n s = s.replaceAll("1","a") s s.replaceAll("1","a") s.replaceAll s "1" "a" s = s.replaceAll("9","b") s s.replaceAll("9","b") s.replaceAll s "9" "b" s = s.replaceAll("a","9") s s.replaceAll("a","9") s.replaceAll s "a" "9" s = s.replaceAll("b","1") s s.replaceAll("b","1") s.replaceAll s "b" "1" System.out.println(s) System.out.println System.out System System.out s String[] args args public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        String s = String.valueOf(n);
        s = s.replaceAll("1","a");
        s = s.replaceAll("9","b");
        s = s.replaceAll("a","9");
        s = s.replaceAll("b","1");
        System.out.println(s);
    }
} public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        String s = String.valueOf(n);
        s = s.replaceAll("1","a");
        s = s.replaceAll("9","b");
        s = s.replaceAll("a","9");
        s = s.replaceAll("b","1");
        System.out.println(s);
    }
} Main
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        String s = String.valueOf(n);
        s = s.replaceAll("1","a");
        s = s.replaceAll("9","b");
        s = s.replaceAll("a","9");
        s = s.replaceAll("b","1");
        System.out.println(s);
    }
}
