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

public class Main {

	public static void main(String[] args) throws IOException {
		// TODO 自動生成されたメソッド・スタブ
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String ans = br.readLine();

		ans = ans.replaceAll("1", "a");
		ans = ans.replaceAll("9", "1");

		System.out.println(ans.replaceAll("a", "9"));
	}

} 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) throws IOException {
		// TODO 自動生成されたメソッド・スタブ
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String ans = br.readLine();

		ans = ans.replaceAll("1", "a");
		ans = ans.replaceAll("9", "1");

		System.out.println(ans.replaceAll("a", "9"));
	}

} Main public static void main(String[] args) throws IOException {
		// TODO 自動生成されたメソッド・スタブ
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String ans = br.readLine();

		ans = ans.replaceAll("1", "a");
		ans = ans.replaceAll("9", "1");

		System.out.println(ans.replaceAll("a", "9"));
	} main {
		// TODO 自動生成されたメソッド・スタブ
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String ans = br.readLine();

		ans = ans.replaceAll("1", "a");
		ans = ans.replaceAll("9", "1");

		System.out.println(ans.replaceAll("a", "9"));
	} BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); br new BufferedReader(new InputStreamReader(System.in)) String ans = br.readLine(); ans br.readLine() br.readLine br ans = ans.replaceAll("1", "a") ans ans.replaceAll("1", "a") ans.replaceAll ans "1" "a" ans = ans.replaceAll("9", "1") ans ans.replaceAll("9", "1") ans.replaceAll ans "9" "1" System.out.println(ans.replaceAll("a", "9")) System.out.println System.out System System.out ans.replaceAll("a", "9") ans.replaceAll ans "a" "9" String[] args args public class Main {

	public static void main(String[] args) throws IOException {
		// TODO 自動生成されたメソッド・スタブ
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String ans = br.readLine();

		ans = ans.replaceAll("1", "a");
		ans = ans.replaceAll("9", "1");

		System.out.println(ans.replaceAll("a", "9"));
	}

} public class Main {

	public static void main(String[] args) throws IOException {
		// TODO 自動生成されたメソッド・スタブ
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String ans = br.readLine();

		ans = ans.replaceAll("1", "a");
		ans = ans.replaceAll("9", "1");

		System.out.println(ans.replaceAll("a", "9"));
	}

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

public class Main {

	public static void main(String[] args) throws IOException {
		// TODO 自動生成されたメソッド・スタブ
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String ans = br.readLine();

		ans = ans.replaceAll("1", "a");
		ans = ans.replaceAll("9", "1");

		System.out.println(ans.replaceAll("a", "9"));
	}

}