import java.util.*;


public class Main {
    public static void main(String[] args) {
        // 自分の得意な言語で
        // Let's チャレンジ！！

        Scanner sc = new Scanner(System.in);
        String line = sc.nextLine();
      line=line.replace("1",",");
      line=line.replace("9","1");
      line=line.replace(",","9");
        System.out.println(line);
    }
} import java.util.*; util.* java public class Main {
    public static void main(String[] args) {
        // 自分の得意な言語で
        // Let's チャレンジ！！

        Scanner sc = new Scanner(System.in);
        String line = sc.nextLine();
      line=line.replace("1",",");
      line=line.replace("9","1");
      line=line.replace(",","9");
        System.out.println(line);
    }
} Main public static void main(String[] args) {
        // 自分の得意な言語で
        // Let's チャレンジ！！

        Scanner sc = new Scanner(System.in);
        String line = sc.nextLine();
      line=line.replace("1",",");
      line=line.replace("9","1");
      line=line.replace(",","9");
        System.out.println(line);
    } main {
        // 自分の得意な言語で
        // Let's チャレンジ！！

        Scanner sc = new Scanner(System.in);
        String line = sc.nextLine();
      line=line.replace("1",",");
      line=line.replace("9","1");
      line=line.replace(",","9");
        System.out.println(line);
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String line = sc.nextLine(); line sc.nextLine() sc.nextLine sc line=line.replace("1",",") line line.replace("1",",") line.replace line "1" "," line=line.replace("9","1") line line.replace("9","1") line.replace line "9" "1" line=line.replace(",","9") line line.replace(",","9") line.replace line "," "9" System.out.println(line) System.out.println System.out System System.out line String[] args args public class Main {
    public static void main(String[] args) {
        // 自分の得意な言語で
        // Let's チャレンジ！！

        Scanner sc = new Scanner(System.in);
        String line = sc.nextLine();
      line=line.replace("1",",");
      line=line.replace("9","1");
      line=line.replace(",","9");
        System.out.println(line);
    }
} public class Main {
    public static void main(String[] args) {
        // 自分の得意な言語で
        // Let's チャレンジ！！

        Scanner sc = new Scanner(System.in);
        String line = sc.nextLine();
      line=line.replace("1",",");
      line=line.replace("9","1");
      line=line.replace(",","9");
        System.out.println(line);
    }
} Main
import java.util.*;


public class Main {
    public static void main(String[] args) {
        // 自分の得意な言語で
        // Let's チャレンジ！！

        Scanner sc = new Scanner(System.in);
        String line = sc.nextLine();
      line=line.replace("1",",");
      line=line.replace("9","1");
      line=line.replace(",","9");
        System.out.println(line);
    }
}