import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        String[] n = sc.next().split("");
        
        for (int i=0; i<n.length; i++) {
            if (n[i].equals("1")) {
                n[i] = "9";
            } else if (n[i].equals("9")) {
                n[i] = "1";
            }
        }
        
        String result = "";
        for (String s : n) {
            result += s;
        }
        System.out.println(result);
    }
} import java.util.*; util.* java public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        String[] n = sc.next().split("");
        
        for (int i=0; i<n.length; i++) {
            if (n[i].equals("1")) {
                n[i] = "9";
            } else if (n[i].equals("9")) {
                n[i] = "1";
            }
        }
        
        String result = "";
        for (String s : n) {
            result += s;
        }
        System.out.println(result);
    }
} Main public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        String[] n = sc.next().split("");
        
        for (int i=0; i<n.length; i++) {
            if (n[i].equals("1")) {
                n[i] = "9";
            } else if (n[i].equals("9")) {
                n[i] = "1";
            }
        }
        
        String result = "";
        for (String s : n) {
            result += s;
        }
        System.out.println(result);
    } main {
        Scanner sc = new Scanner(System.in);
        String[] n = sc.next().split("");
        
        for (int i=0; i<n.length; i++) {
            if (n[i].equals("1")) {
                n[i] = "9";
            } else if (n[i].equals("9")) {
                n[i] = "1";
            }
        }
        
        String result = "";
        for (String s : n) {
            result += s;
        }
        System.out.println(result);
    } 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 (n[i].equals("1")) {
                n[i] = "9";
            } else if (n[i].equals("9")) {
                n[i] = "1";
            }
        } int i=0; int i=0; i 0 i<n.length i n.length n n.length i++ i++ i {
            if (n[i].equals("1")) {
                n[i] = "9";
            } else if (n[i].equals("9")) {
                n[i] = "1";
            }
        } {
            if (n[i].equals("1")) {
                n[i] = "9";
            } else if (n[i].equals("9")) {
                n[i] = "1";
            }
        } if (n[i].equals("1")) {
                n[i] = "9";
            } else if (n[i].equals("9")) {
                n[i] = "1";
            } n[i].equals("1") n[i].equals n[i] n i "1" {
                n[i] = "9";
            } n[i] = "9" n[i] n i "9" if (n[i].equals("9")) {
                n[i] = "1";
            } n[i].equals("9") n[i].equals n[i] n i "9" {
                n[i] = "1";
            } n[i] = "1" n[i] n i "1" String result = ""; result "" for (String s : n) {
            result += s;
        } String s n {
            result += s;
        } {
            result += s;
        } result += s result s System.out.println(result) System.out.println System.out System System.out result String[] args args public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        String[] n = sc.next().split("");
        
        for (int i=0; i<n.length; i++) {
            if (n[i].equals("1")) {
                n[i] = "9";
            } else if (n[i].equals("9")) {
                n[i] = "1";
            }
        }
        
        String result = "";
        for (String s : n) {
            result += s;
        }
        System.out.println(result);
    }
} public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        String[] n = sc.next().split("");
        
        for (int i=0; i<n.length; i++) {
            if (n[i].equals("1")) {
                n[i] = "9";
            } else if (n[i].equals("9")) {
                n[i] = "1";
            }
        }
        
        String result = "";
        for (String s : n) {
            result += s;
        }
        System.out.println(result);
    }
} Main
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        String[] n = sc.next().split("");
        
        for (int i=0; i<n.length; i++) {
            if (n[i].equals("1")) {
                n[i] = "9";
            } else if (n[i].equals("9")) {
                n[i] = "1";
            }
        }
        
        String result = "";
        for (String s : n) {
            result += s;
        }
        System.out.println(result);
    }
}
