import java.util.Scanner;

public class Main {
    
    public static void main(String[] args) {
        
        Scanner sc = new Scanner(System.in);
        
        String s = sc.next();
        
        s = s.replace('1', '-');
        s = s.replace('9', '1');
        s = s.replace('-', '9');
        
        System.out.println(s);
    }
} import java.util.Scanner; Scanner java.util public class Main {
    
    public static void main(String[] args) {
        
        Scanner sc = new Scanner(System.in);
        
        String s = sc.next();
        
        s = s.replace('1', '-');
        s = s.replace('9', '1');
        s = s.replace('-', '9');
        
        System.out.println(s);
    }
} Main public static void main(String[] args) {
        
        Scanner sc = new Scanner(System.in);
        
        String s = sc.next();
        
        s = s.replace('1', '-');
        s = s.replace('9', '1');
        s = s.replace('-', '9');
        
        System.out.println(s);
    } main {
        
        Scanner sc = new Scanner(System.in);
        
        String s = sc.next();
        
        s = s.replace('1', '-');
        s = s.replace('9', '1');
        s = s.replace('-', '9');
        
        System.out.println(s);
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String s = sc.next(); s sc.next() sc.next sc s = s.replace('1', '-') s s.replace('1', '-') s.replace s '1' '-' s = s.replace('9', '1') s s.replace('9', '1') s.replace s '9' '1' s = s.replace('-', '9') s s.replace('-', '9') s.replace s '-' '9' 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);
        
        String s = sc.next();
        
        s = s.replace('1', '-');
        s = s.replace('9', '1');
        s = s.replace('-', '9');
        
        System.out.println(s);
    }
} public class Main {
    
    public static void main(String[] args) {
        
        Scanner sc = new Scanner(System.in);
        
        String s = sc.next();
        
        s = s.replace('1', '-');
        s = s.replace('9', '1');
        s = s.replace('-', '9');
        
        System.out.println(s);
    }
} Main
import java.util.Scanner;

public class Main {
    
    public static void main(String[] args) {
        
        Scanner sc = new Scanner(System.in);
        
        String s = sc.next();
        
        s = s.replace('1', '-');
        s = s.replace('9', '1');
        s = s.replace('-', '9');
        
        System.out.println(s);
    }
}