import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {
    public static void main(String[] args) {
        try {
            // 標準入力
            InputStreamReader isr = new InputStreamReader(System.in);
            BufferedReader br = new BufferedReader(isr);
            String s = br.readLine();
            StringBuffer strBuf = new StringBuffer();
            for (int i = 0; i < s.length(); i++) {
                char ch = s.charAt(i);
                if (ch == '1') {
                    strBuf.append("9");
                } else if (ch == '9') {
                    strBuf.append("1");
                } else {
                    strBuf.append(ch);
                }
            }
            System.out.println(strBuf.toString());
        } catch (IOException e) {
            e.printStackTrace();
        }
    }

} import java.io.BufferedReader; BufferedReader java.io import java.io.IOException; IOException java.io import java.io.InputStreamReader; InputStreamReader java.io public class Main {
    public static void main(String[] args) {
        try {
            // 標準入力
            InputStreamReader isr = new InputStreamReader(System.in);
            BufferedReader br = new BufferedReader(isr);
            String s = br.readLine();
            StringBuffer strBuf = new StringBuffer();
            for (int i = 0; i < s.length(); i++) {
                char ch = s.charAt(i);
                if (ch == '1') {
                    strBuf.append("9");
                } else if (ch == '9') {
                    strBuf.append("1");
                } else {
                    strBuf.append(ch);
                }
            }
            System.out.println(strBuf.toString());
        } catch (IOException e) {
            e.printStackTrace();
        }
    }

} Main public static void main(String[] args) {
        try {
            // 標準入力
            InputStreamReader isr = new InputStreamReader(System.in);
            BufferedReader br = new BufferedReader(isr);
            String s = br.readLine();
            StringBuffer strBuf = new StringBuffer();
            for (int i = 0; i < s.length(); i++) {
                char ch = s.charAt(i);
                if (ch == '1') {
                    strBuf.append("9");
                } else if (ch == '9') {
                    strBuf.append("1");
                } else {
                    strBuf.append(ch);
                }
            }
            System.out.println(strBuf.toString());
        } catch (IOException e) {
            e.printStackTrace();
        }
    } main {
        try {
            // 標準入力
            InputStreamReader isr = new InputStreamReader(System.in);
            BufferedReader br = new BufferedReader(isr);
            String s = br.readLine();
            StringBuffer strBuf = new StringBuffer();
            for (int i = 0; i < s.length(); i++) {
                char ch = s.charAt(i);
                if (ch == '1') {
                    strBuf.append("9");
                } else if (ch == '9') {
                    strBuf.append("1");
                } else {
                    strBuf.append(ch);
                }
            }
            System.out.println(strBuf.toString());
        } catch (IOException e) {
            e.printStackTrace();
        }
    } try {
            // 標準入力
            InputStreamReader isr = new InputStreamReader(System.in);
            BufferedReader br = new BufferedReader(isr);
            String s = br.readLine();
            StringBuffer strBuf = new StringBuffer();
            for (int i = 0; i < s.length(); i++) {
                char ch = s.charAt(i);
                if (ch == '1') {
                    strBuf.append("9");
                } else if (ch == '9') {
                    strBuf.append("1");
                } else {
                    strBuf.append(ch);
                }
            }
            System.out.println(strBuf.toString());
        } catch (IOException e) {
            e.printStackTrace();
        } catch (IOException e) {
            e.printStackTrace();
        } IOException e {
            e.printStackTrace();
        } e.printStackTrace() e.printStackTrace e {
            // 標準入力
            InputStreamReader isr = new InputStreamReader(System.in);
            BufferedReader br = new BufferedReader(isr);
            String s = br.readLine();
            StringBuffer strBuf = new StringBuffer();
            for (int i = 0; i < s.length(); i++) {
                char ch = s.charAt(i);
                if (ch == '1') {
                    strBuf.append("9");
                } else if (ch == '9') {
                    strBuf.append("1");
                } else {
                    strBuf.append(ch);
                }
            }
            System.out.println(strBuf.toString());
        } InputStreamReader isr = new InputStreamReader(System.in); isr new InputStreamReader(System.in) BufferedReader br = new BufferedReader(isr); br new BufferedReader(isr) String s = br.readLine(); s br.readLine() br.readLine br StringBuffer strBuf = new StringBuffer(); strBuf new StringBuffer() for (int i = 0; i < s.length(); i++) {
                char ch = s.charAt(i);
                if (ch == '1') {
                    strBuf.append("9");
                } else if (ch == '9') {
                    strBuf.append("1");
                } else {
                    strBuf.append(ch);
                }
            } int i = 0; int i = 0; i 0 i < s.length() i s.length() s.length s i++ i++ i {
                char ch = s.charAt(i);
                if (ch == '1') {
                    strBuf.append("9");
                } else if (ch == '9') {
                    strBuf.append("1");
                } else {
                    strBuf.append(ch);
                }
            } {
                char ch = s.charAt(i);
                if (ch == '1') {
                    strBuf.append("9");
                } else if (ch == '9') {
                    strBuf.append("1");
                } else {
                    strBuf.append(ch);
                }
            } char ch = s.charAt(i); ch s.charAt(i) s.charAt s i if (ch == '1') {
                    strBuf.append("9");
                } else if (ch == '9') {
                    strBuf.append("1");
                } else {
                    strBuf.append(ch);
                } ch == '1' ch '1' {
                    strBuf.append("9");
                } strBuf.append("9") strBuf.append strBuf "9" if (ch == '9') {
                    strBuf.append("1");
                } else {
                    strBuf.append(ch);
                } ch == '9' ch '9' {
                    strBuf.append("1");
                } strBuf.append("1") strBuf.append strBuf "1" {
                    strBuf.append(ch);
                } strBuf.append(ch) strBuf.append strBuf ch System.out.println(strBuf.toString()) System.out.println System.out System System.out strBuf.toString() strBuf.toString strBuf String[] args args public class Main {
    public static void main(String[] args) {
        try {
            // 標準入力
            InputStreamReader isr = new InputStreamReader(System.in);
            BufferedReader br = new BufferedReader(isr);
            String s = br.readLine();
            StringBuffer strBuf = new StringBuffer();
            for (int i = 0; i < s.length(); i++) {
                char ch = s.charAt(i);
                if (ch == '1') {
                    strBuf.append("9");
                } else if (ch == '9') {
                    strBuf.append("1");
                } else {
                    strBuf.append(ch);
                }
            }
            System.out.println(strBuf.toString());
        } catch (IOException e) {
            e.printStackTrace();
        }
    }

} public class Main {
    public static void main(String[] args) {
        try {
            // 標準入力
            InputStreamReader isr = new InputStreamReader(System.in);
            BufferedReader br = new BufferedReader(isr);
            String s = br.readLine();
            StringBuffer strBuf = new StringBuffer();
            for (int i = 0; i < s.length(); i++) {
                char ch = s.charAt(i);
                if (ch == '1') {
                    strBuf.append("9");
                } else if (ch == '9') {
                    strBuf.append("1");
                } else {
                    strBuf.append(ch);
                }
            }
            System.out.println(strBuf.toString());
        } catch (IOException e) {
            e.printStackTrace();
        }
    }

} Main
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {
    public static void main(String[] args) {
        try {
            // 標準入力
            InputStreamReader isr = new InputStreamReader(System.in);
            BufferedReader br = new BufferedReader(isr);
            String s = br.readLine();
            StringBuffer strBuf = new StringBuffer();
            for (int i = 0; i < s.length(); i++) {
                char ch = s.charAt(i);
                if (ch == '1') {
                    strBuf.append("9");
                } else if (ch == '9') {
                    strBuf.append("1");
                } else {
                    strBuf.append(ch);
                }
            }
            System.out.println(strBuf.toString());
        } catch (IOException e) {
            e.printStackTrace();
        }
    }

}
