import java.util.*;
import java.io.*;
import java.lang.*;

public class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        String n = sc.next();
        
        StringBuilder ans = new StringBuilder();
        
        for (int i = 0; i<n.length();i++) {
            if (n.charAt(i) == '1')
                ans.append('9');
            else if (n.charAt(i) == '9')
                ans.append('1');
        }
        System.out.println(ans);
    }
} import java.util.*; util.* java import java.io.*; io.* java import java.lang.*; lang.* java public class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        String n = sc.next();
        
        StringBuilder ans = new StringBuilder();
        
        for (int i = 0; i<n.length();i++) {
            if (n.charAt(i) == '1')
                ans.append('9');
            else if (n.charAt(i) == '9')
                ans.append('1');
        }
        System.out.println(ans);
    }
} Main public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        String n = sc.next();
        
        StringBuilder ans = new StringBuilder();
        
        for (int i = 0; i<n.length();i++) {
            if (n.charAt(i) == '1')
                ans.append('9');
            else if (n.charAt(i) == '9')
                ans.append('1');
        }
        System.out.println(ans);
    } main {
        Scanner sc = new Scanner(System.in);
        String n = sc.next();
        
        StringBuilder ans = new StringBuilder();
        
        for (int i = 0; i<n.length();i++) {
            if (n.charAt(i) == '1')
                ans.append('9');
            else if (n.charAt(i) == '9')
                ans.append('1');
        }
        System.out.println(ans);
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String n = sc.next(); n sc.next() sc.next sc StringBuilder ans = new StringBuilder(); ans new StringBuilder() for (int i = 0; i<n.length();i++) {
            if (n.charAt(i) == '1')
                ans.append('9');
            else if (n.charAt(i) == '9')
                ans.append('1');
        } int i = 0; int i = 0; i 0 i<n.length() i n.length() n.length n i++ i++ i {
            if (n.charAt(i) == '1')
                ans.append('9');
            else if (n.charAt(i) == '9')
                ans.append('1');
        } {
            if (n.charAt(i) == '1')
                ans.append('9');
            else if (n.charAt(i) == '9')
                ans.append('1');
        } if (n.charAt(i) == '1')
                ans.append('9');
            else if (n.charAt(i) == '9')
                ans.append('1'); n.charAt(i) == '1' n.charAt(i) n.charAt n i '1' ans.append('9') ans.append ans '9' if (n.charAt(i) == '9')
                ans.append('1'); n.charAt(i) == '9' n.charAt(i) n.charAt n i '9' ans.append('1') ans.append ans '1' System.out.println(ans) System.out.println System.out System System.out ans String[] args args public class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        String n = sc.next();
        
        StringBuilder ans = new StringBuilder();
        
        for (int i = 0; i<n.length();i++) {
            if (n.charAt(i) == '1')
                ans.append('9');
            else if (n.charAt(i) == '9')
                ans.append('1');
        }
        System.out.println(ans);
    }
} public class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        String n = sc.next();
        
        StringBuilder ans = new StringBuilder();
        
        for (int i = 0; i<n.length();i++) {
            if (n.charAt(i) == '1')
                ans.append('9');
            else if (n.charAt(i) == '9')
                ans.append('1');
        }
        System.out.println(ans);
    }
} Main
import java.util.*;
import java.io.*;
import java.lang.*;

public class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        String n = sc.next();
        
        StringBuilder ans = new StringBuilder();
        
        for (int i = 0; i<n.length();i++) {
            if (n.charAt(i) == '1')
                ans.append('9');
            else if (n.charAt(i) == '9')
                ans.append('1');
        }
        System.out.println(ans);
    }
}
