import java.util.Scanner;
import java.util.List;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
	String a = sc.next();
	a=a.replace("1","q");
    a=a.replace("9","l");
    a=a.replace("q","9");
    a=a.replace("l","1");
    System.out.println(a);
  }
} import java.util.Scanner; Scanner java.util import java.util.List; List java.util import java.util.ArrayList; ArrayList java.util import java.util.Collections; Collections java.util import java.util.List; List java.util class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
	String a = sc.next();
	a=a.replace("1","q");
    a=a.replace("9","l");
    a=a.replace("q","9");
    a=a.replace("l","1");
    System.out.println(a);
  }
} Main public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
	String a = sc.next();
	a=a.replace("1","q");
    a=a.replace("9","l");
    a=a.replace("q","9");
    a=a.replace("l","1");
    System.out.println(a);
  } main {
    Scanner sc = new Scanner(System.in);
	String a = sc.next();
	a=a.replace("1","q");
    a=a.replace("9","l");
    a=a.replace("q","9");
    a=a.replace("l","1");
    System.out.println(a);
  } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String a = sc.next(); a sc.next() sc.next sc a=a.replace("1","q") a a.replace("1","q") a.replace a "1" "q" a=a.replace("9","l") a a.replace("9","l") a.replace a "9" "l" a=a.replace("q","9") a a.replace("q","9") a.replace a "q" "9" a=a.replace("l","1") a a.replace("l","1") a.replace a "l" "1" System.out.println(a) System.out.println System.out System System.out a String[] args args
import java.util.Scanner;
import java.util.List;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
	String a = sc.next();
	a=a.replace("1","q");
    a=a.replace("9","l");
    a=a.replace("q","9");
    a=a.replace("l","1");
    System.out.println(a);
  }
}