import java.util.*;
public class Main{
public static void main(String[] args){
Scanner sc = new Scanner(System.in);
  int k = sc.nextInt();
  if(k==111){
     System.out.println(999);
    }else if(k==119){
       System.out.println(991);
    }else if(k==199){
       System.out.println(911);
    }else if(k==999){
       System.out.println(111);
    }else if(k==911){
     System.out.println(199);
    }else if(k==991){
     System.out.println(119);
    }else if(k==919){
     System.out.println(191);
    }else if(k==191){
     System.out.println(919);
  }}} import java.util.*; util.* java public class Main{
public static void main(String[] args){
Scanner sc = new Scanner(System.in);
  int k = sc.nextInt();
  if(k==111){
     System.out.println(999);
    }else if(k==119){
       System.out.println(991);
    }else if(k==199){
       System.out.println(911);
    }else if(k==999){
       System.out.println(111);
    }else if(k==911){
     System.out.println(199);
    }else if(k==991){
     System.out.println(119);
    }else if(k==919){
     System.out.println(191);
    }else if(k==191){
     System.out.println(919);
  }}} Main public static void main(String[] args){
Scanner sc = new Scanner(System.in);
  int k = sc.nextInt();
  if(k==111){
     System.out.println(999);
    }else if(k==119){
       System.out.println(991);
    }else if(k==199){
       System.out.println(911);
    }else if(k==999){
       System.out.println(111);
    }else if(k==911){
     System.out.println(199);
    }else if(k==991){
     System.out.println(119);
    }else if(k==919){
     System.out.println(191);
    }else if(k==191){
     System.out.println(919);
  }} main {
Scanner sc = new Scanner(System.in);
  int k = sc.nextInt();
  if(k==111){
     System.out.println(999);
    }else if(k==119){
       System.out.println(991);
    }else if(k==199){
       System.out.println(911);
    }else if(k==999){
       System.out.println(111);
    }else if(k==911){
     System.out.println(199);
    }else if(k==991){
     System.out.println(119);
    }else if(k==919){
     System.out.println(191);
    }else if(k==191){
     System.out.println(919);
  }} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int k = sc.nextInt(); k sc.nextInt() sc.nextInt sc if(k==111){
     System.out.println(999);
    }else if(k==119){
       System.out.println(991);
    }else if(k==199){
       System.out.println(911);
    }else if(k==999){
       System.out.println(111);
    }else if(k==911){
     System.out.println(199);
    }else if(k==991){
     System.out.println(119);
    }else if(k==919){
     System.out.println(191);
    }else if(k==191){
     System.out.println(919);
  } k==111 k 111 {
     System.out.println(999);
    } System.out.println(999) System.out.println System.out System System.out 999 if(k==119){
       System.out.println(991);
    }else if(k==199){
       System.out.println(911);
    }else if(k==999){
       System.out.println(111);
    }else if(k==911){
     System.out.println(199);
    }else if(k==991){
     System.out.println(119);
    }else if(k==919){
     System.out.println(191);
    }else if(k==191){
     System.out.println(919);
  } k==119 k 119 {
       System.out.println(991);
    } System.out.println(991) System.out.println System.out System System.out 991 if(k==199){
       System.out.println(911);
    }else if(k==999){
       System.out.println(111);
    }else if(k==911){
     System.out.println(199);
    }else if(k==991){
     System.out.println(119);
    }else if(k==919){
     System.out.println(191);
    }else if(k==191){
     System.out.println(919);
  } k==199 k 199 {
       System.out.println(911);
    } System.out.println(911) System.out.println System.out System System.out 911 if(k==999){
       System.out.println(111);
    }else if(k==911){
     System.out.println(199);
    }else if(k==991){
     System.out.println(119);
    }else if(k==919){
     System.out.println(191);
    }else if(k==191){
     System.out.println(919);
  } k==999 k 999 {
       System.out.println(111);
    } System.out.println(111) System.out.println System.out System System.out 111 if(k==911){
     System.out.println(199);
    }else if(k==991){
     System.out.println(119);
    }else if(k==919){
     System.out.println(191);
    }else if(k==191){
     System.out.println(919);
  } k==911 k 911 {
     System.out.println(199);
    } System.out.println(199) System.out.println System.out System System.out 199 if(k==991){
     System.out.println(119);
    }else if(k==919){
     System.out.println(191);
    }else if(k==191){
     System.out.println(919);
  } k==991 k 991 {
     System.out.println(119);
    } System.out.println(119) System.out.println System.out System System.out 119 if(k==919){
     System.out.println(191);
    }else if(k==191){
     System.out.println(919);
  } k==919 k 919 {
     System.out.println(191);
    } System.out.println(191) System.out.println System.out System System.out 191 if(k==191){
     System.out.println(919);
  } k==191 k 191 {
     System.out.println(919);
  } System.out.println(919) System.out.println System.out System System.out 919 String[] args args public class Main{
public static void main(String[] args){
Scanner sc = new Scanner(System.in);
  int k = sc.nextInt();
  if(k==111){
     System.out.println(999);
    }else if(k==119){
       System.out.println(991);
    }else if(k==199){
       System.out.println(911);
    }else if(k==999){
       System.out.println(111);
    }else if(k==911){
     System.out.println(199);
    }else if(k==991){
     System.out.println(119);
    }else if(k==919){
     System.out.println(191);
    }else if(k==191){
     System.out.println(919);
  }}} public class Main{
public static void main(String[] args){
Scanner sc = new Scanner(System.in);
  int k = sc.nextInt();
  if(k==111){
     System.out.println(999);
    }else if(k==119){
       System.out.println(991);
    }else if(k==199){
       System.out.println(911);
    }else if(k==999){
       System.out.println(111);
    }else if(k==911){
     System.out.println(199);
    }else if(k==991){
     System.out.println(119);
    }else if(k==919){
     System.out.println(191);
    }else if(k==191){
     System.out.println(919);
  }}} Main
import java.util.*;
public class Main{
public static void main(String[] args){
Scanner sc = new Scanner(System.in);
  int k = sc.nextInt();
  if(k==111){
     System.out.println(999);
    }else if(k==119){
       System.out.println(991);
    }else if(k==199){
       System.out.println(911);
    }else if(k==999){
       System.out.println(111);
    }else if(k==911){
     System.out.println(199);
    }else if(k==991){
     System.out.println(119);
    }else if(k==919){
     System.out.println(191);
    }else if(k==191){
     System.out.println(919);
  }}}