
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.math.BigDecimal;
import java.util.Arrays;
import java.util.StringTokenizer;

import java.util.Scanner;
public class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        String c = sc.next();
        String c1 = String.valueOf(c.charAt(0));
        String c2 = String.valueOf(c.charAt(1));
        String c3 = String.valueOf(c.charAt(2));
        
        c1=change19(c1);
        c2=change19(c2);
        c3=change19(c3);
        
    	System.out.println(c1 + c2 + c3);   
    
    }
    private static String change19(String str) {
    	if ("1".equals(str)) {
    		str="9";
    	} else if ("9".equals(str)) {
    		str="1";
    	}
    	
    	return str;
    }
}
/tmp/hf-datasets-cache/medium/datasets/42704881117311-config-parquet-and-info-qiankunmu-Project_CodeNet-896c9d36/hub/datasets--qiankunmu--Project_CodeNet_Python800_and_Java250/snapshots/c899fde44a77ba1cc14973ed3de064e4ff3aadc7/Project_CodeNet_Java250.tar.gz