/* package codechef; // don't place package name! */

import java.util.*;
import java.lang.*;
import java.io.*;

/* Name of the class has to be "Main" only if the class is public. */
public class Main
{
	public static void main (String[] args) throws java.lang.Exception
	{
		// your code goes here
		FastReader sc=new FastReader();
		    String s=sc.next();char ch[]=s.toCharArray();int n=s.length(),a[]=new int[n],i;
		    for(i=0;i<n;i++)
		       a[i]=1;
		    for(i=0;i<n;i++){
		        if(ch[i]=='9' && a[i]!=0){
		            ch[i]='1';a[i]=0;
		        }
		        else if(ch[i]=='1' && a[i]!=0){
		            ch[i]='9';a[i]=0;
		        }
		    }
		     for(i=0;i<n;i++)
		       System.out.print(ch[i]);
		      System.out.println();
	}
	 static class FastReader{
          BufferedReader in;
          StringTokenizer st;
          public FastReader(){
              in=new BufferedReader(new InputStreamReader(System.in));
          }
          String next(){
              while(st==null || !st.hasMoreElements()){
                  try{
                      st=new StringTokenizer(in.readLine());
                  }
                  catch(IOException e){
                      e.printStackTrace();
                  }
               }
               return st.nextToken();
            }
            int nextInt(){
                return Integer.parseInt(next());
            }
            long nextLong(){
                return Long.parseLong(next());
            }
            double nextDouble(){
                return Double.parseDouble(next());
            }
            String nextLine(){
            String str19 = "";
            try{
                str19 = in.readLine();
            }
            catch (IOException e){
                e.printStackTrace();
             }
            return str19;
        }
      }    
} import java.util.*; util.* java import java.lang.*; lang.* java import java.io.*; io.* java public class Main
{
	public static void main (String[] args) throws java.lang.Exception
	{
		// your code goes here
		FastReader sc=new FastReader();
		    String s=sc.next();char ch[]=s.toCharArray();int n=s.length(),a[]=new int[n],i;
		    for(i=0;i<n;i++)
		       a[i]=1;
		    for(i=0;i<n;i++){
		        if(ch[i]=='9' && a[i]!=0){
		            ch[i]='1';a[i]=0;
		        }
		        else if(ch[i]=='1' && a[i]!=0){
		            ch[i]='9';a[i]=0;
		        }
		    }
		     for(i=0;i<n;i++)
		       System.out.print(ch[i]);
		      System.out.println();
	}
	 static class FastReader{
          BufferedReader in;
          StringTokenizer st;
          public FastReader(){
              in=new BufferedReader(new InputStreamReader(System.in));
          }
          String next(){
              while(st==null || !st.hasMoreElements()){
                  try{
                      st=new StringTokenizer(in.readLine());
                  }
                  catch(IOException e){
                      e.printStackTrace();
                  }
               }
               return st.nextToken();
            }
            int nextInt(){
                return Integer.parseInt(next());
            }
            long nextLong(){
                return Long.parseLong(next());
            }
            double nextDouble(){
                return Double.parseDouble(next());
            }
            String nextLine(){
            String str19 = "";
            try{
                str19 = in.readLine();
            }
            catch (IOException e){
                e.printStackTrace();
             }
            return str19;
        }
      }    
} Main public static void main (String[] args) throws java.lang.Exception
	{
		// your code goes here
		FastReader sc=new FastReader();
		    String s=sc.next();char ch[]=s.toCharArray();int n=s.length(),a[]=new int[n],i;
		    for(i=0;i<n;i++)
		       a[i]=1;
		    for(i=0;i<n;i++){
		        if(ch[i]=='9' && a[i]!=0){
		            ch[i]='1';a[i]=0;
		        }
		        else if(ch[i]=='1' && a[i]!=0){
		            ch[i]='9';a[i]=0;
		        }
		    }
		     for(i=0;i<n;i++)
		       System.out.print(ch[i]);
		      System.out.println();
	} main {
		// your code goes here
		FastReader sc=new FastReader();
		    String s=sc.next();char ch[]=s.toCharArray();int n=s.length(),a[]=new int[n],i;
		    for(i=0;i<n;i++)
		       a[i]=1;
		    for(i=0;i<n;i++){
		        if(ch[i]=='9' && a[i]!=0){
		            ch[i]='1';a[i]=0;
		        }
		        else if(ch[i]=='1' && a[i]!=0){
		            ch[i]='9';a[i]=0;
		        }
		    }
		     for(i=0;i<n;i++)
		       System.out.print(ch[i]);
		      System.out.println();
	} FastReader sc=new FastReader(); sc new FastReader() String s=sc.next(); s sc.next() sc.next sc char ch[]=s.toCharArray(); ch s.toCharArray() s.toCharArray s int n=s.length() n s.length() s.length s a[]=new int[n] a new int[n] n i; i for(i=0;i<n;i++)
		       a[i]=1; i=0; i=0 i 0 i<n i n i++ i++ i a[i]=1; a[i]=1 a[i] a i 1 for(i=0;i<n;i++){
		        if(ch[i]=='9' && a[i]!=0){
		            ch[i]='1';a[i]=0;
		        }
		        else if(ch[i]=='1' && a[i]!=0){
		            ch[i]='9';a[i]=0;
		        }
		    } i=0; i=0 i 0 i<n i n i++ i++ i {
		        if(ch[i]=='9' && a[i]!=0){
		            ch[i]='1';a[i]=0;
		        }
		        else if(ch[i]=='1' && a[i]!=0){
		            ch[i]='9';a[i]=0;
		        }
		    } {
		        if(ch[i]=='9' && a[i]!=0){
		            ch[i]='1';a[i]=0;
		        }
		        else if(ch[i]=='1' && a[i]!=0){
		            ch[i]='9';a[i]=0;
		        }
		    } if(ch[i]=='9' && a[i]!=0){
		            ch[i]='1';a[i]=0;
		        }
		        else if(ch[i]=='1' && a[i]!=0){
		            ch[i]='9';a[i]=0;
		        } ch[i]=='9' && a[i]!=0 ch[i]=='9' ch[i] ch i '9' a[i]!=0 a[i] a i 0 {
		            ch[i]='1';a[i]=0;
		        } ch[i]='1' ch[i] ch i '1' a[i]=0 a[i] a i 0 if(ch[i]=='1' && a[i]!=0){
		            ch[i]='9';a[i]=0;
		        } ch[i]=='1' && a[i]!=0 ch[i]=='1' ch[i] ch i '1' a[i]!=0 a[i] a i 0 {
		            ch[i]='9';a[i]=0;
		        } ch[i]='9' ch[i] ch i '9' a[i]=0 a[i] a i 0 for(i=0;i<n;i++)
		       System.out.print(ch[i]); i=0; i=0 i 0 i<n i n i++ i++ i System.out.print(ch[i]); System.out.print(ch[i]) System.out.print System.out System System.out ch[i] ch i System.out.println() System.out.println System.out System System.out String[] args args static class FastReader{
          BufferedReader in;
          StringTokenizer st;
          public FastReader(){
              in=new BufferedReader(new InputStreamReader(System.in));
          }
          String next(){
              while(st==null || !st.hasMoreElements()){
                  try{
                      st=new StringTokenizer(in.readLine());
                  }
                  catch(IOException e){
                      e.printStackTrace();
                  }
               }
               return st.nextToken();
            }
            int nextInt(){
                return Integer.parseInt(next());
            }
            long nextLong(){
                return Long.parseLong(next());
            }
            double nextDouble(){
                return Double.parseDouble(next());
            }
            String nextLine(){
            String str19 = "";
            try{
                str19 = in.readLine();
            }
            catch (IOException e){
                e.printStackTrace();
             }
            return str19;
        }
      } FastReader BufferedReader in; in StringTokenizer st; st public FastReader(){
              in=new BufferedReader(new InputStreamReader(System.in));
          } FastReader {
              in=new BufferedReader(new InputStreamReader(System.in));
          } in=new BufferedReader(new InputStreamReader(System.in)) in new BufferedReader(new InputStreamReader(System.in)) String next(){
              while(st==null || !st.hasMoreElements()){
                  try{
                      st=new StringTokenizer(in.readLine());
                  }
                  catch(IOException e){
                      e.printStackTrace();
                  }
               }
               return st.nextToken();
            } next {
              while(st==null || !st.hasMoreElements()){
                  try{
                      st=new StringTokenizer(in.readLine());
                  }
                  catch(IOException e){
                      e.printStackTrace();
                  }
               }
               return st.nextToken();
            } while(st==null || !st.hasMoreElements()){
                  try{
                      st=new StringTokenizer(in.readLine());
                  }
                  catch(IOException e){
                      e.printStackTrace();
                  }
               } st==null || !st.hasMoreElements() st==null st null !st.hasMoreElements() st.hasMoreElements() st.hasMoreElements st {
                  try{
                      st=new StringTokenizer(in.readLine());
                  }
                  catch(IOException e){
                      e.printStackTrace();
                  }
               } try{
                      st=new StringTokenizer(in.readLine());
                  }
                  catch(IOException e){
                      e.printStackTrace();
                  } catch(IOException e){
                      e.printStackTrace();
                  } IOException e {
                      e.printStackTrace();
                  } e.printStackTrace() e.printStackTrace e {
                      st=new StringTokenizer(in.readLine());
                  } st=new StringTokenizer(in.readLine()) st new StringTokenizer(in.readLine()) return st.nextToken(); st.nextToken() st.nextToken st int nextInt(){
                return Integer.parseInt(next());
            } nextInt {
                return Integer.parseInt(next());
            } return Integer.parseInt(next()); Integer.parseInt(next()) Integer.parseInt Integer next() next long nextLong(){
                return Long.parseLong(next());
            } nextLong {
                return Long.parseLong(next());
            } return Long.parseLong(next()); Long.parseLong(next()) Long.parseLong Long next() next double nextDouble(){
                return Double.parseDouble(next());
            } nextDouble {
                return Double.parseDouble(next());
            } return Double.parseDouble(next()); Double.parseDouble(next()) Double.parseDouble Double next() next String nextLine(){
            String str19 = "";
            try{
                str19 = in.readLine();
            }
            catch (IOException e){
                e.printStackTrace();
             }
            return str19;
        } nextLine {
            String str19 = "";
            try{
                str19 = in.readLine();
            }
            catch (IOException e){
                e.printStackTrace();
             }
            return str19;
        } String str19 = ""; str19 "" try{
                str19 = in.readLine();
            }
            catch (IOException e){
                e.printStackTrace();
             } catch (IOException e){
                e.printStackTrace();
             } IOException e {
                e.printStackTrace();
             } e.printStackTrace() e.printStackTrace e {
                str19 = in.readLine();
            } str19 = in.readLine() str19 in.readLine() in.readLine in return str19; str19 public class Main
{
	public static void main (String[] args) throws java.lang.Exception
	{
		// your code goes here
		FastReader sc=new FastReader();
		    String s=sc.next();char ch[]=s.toCharArray();int n=s.length(),a[]=new int[n],i;
		    for(i=0;i<n;i++)
		       a[i]=1;
		    for(i=0;i<n;i++){
		        if(ch[i]=='9' && a[i]!=0){
		            ch[i]='1';a[i]=0;
		        }
		        else if(ch[i]=='1' && a[i]!=0){
		            ch[i]='9';a[i]=0;
		        }
		    }
		     for(i=0;i<n;i++)
		       System.out.print(ch[i]);
		      System.out.println();
	}
	 static class FastReader{
          BufferedReader in;
          StringTokenizer st;
          public FastReader(){
              in=new BufferedReader(new InputStreamReader(System.in));
          }
          String next(){
              while(st==null || !st.hasMoreElements()){
                  try{
                      st=new StringTokenizer(in.readLine());
                  }
                  catch(IOException e){
                      e.printStackTrace();
                  }
               }
               return st.nextToken();
            }
            int nextInt(){
                return Integer.parseInt(next());
            }
            long nextLong(){
                return Long.parseLong(next());
            }
            double nextDouble(){
                return Double.parseDouble(next());
            }
            String nextLine(){
            String str19 = "";
            try{
                str19 = in.readLine();
            }
            catch (IOException e){
                e.printStackTrace();
             }
            return str19;
        }
      }    
} public class Main
{
	public static void main (String[] args) throws java.lang.Exception
	{
		// your code goes here
		FastReader sc=new FastReader();
		    String s=sc.next();char ch[]=s.toCharArray();int n=s.length(),a[]=new int[n],i;
		    for(i=0;i<n;i++)
		       a[i]=1;
		    for(i=0;i<n;i++){
		        if(ch[i]=='9' && a[i]!=0){
		            ch[i]='1';a[i]=0;
		        }
		        else if(ch[i]=='1' && a[i]!=0){
		            ch[i]='9';a[i]=0;
		        }
		    }
		     for(i=0;i<n;i++)
		       System.out.print(ch[i]);
		      System.out.println();
	}
	 static class FastReader{
          BufferedReader in;
          StringTokenizer st;
          public FastReader(){
              in=new BufferedReader(new InputStreamReader(System.in));
          }
          String next(){
              while(st==null || !st.hasMoreElements()){
                  try{
                      st=new StringTokenizer(in.readLine());
                  }
                  catch(IOException e){
                      e.printStackTrace();
                  }
               }
               return st.nextToken();
            }
            int nextInt(){
                return Integer.parseInt(next());
            }
            long nextLong(){
                return Long.parseLong(next());
            }
            double nextDouble(){
                return Double.parseDouble(next());
            }
            String nextLine(){
            String str19 = "";
            try{
                str19 = in.readLine();
            }
            catch (IOException e){
                e.printStackTrace();
             }
            return str19;
        }
      }    
} Main
/* package codechef; // don't place package name! */

import java.util.*;
import java.lang.*;
import java.io.*;

/* Name of the class has to be "Main" only if the class is public. */
public class Main
{
	public static void main (String[] args) throws java.lang.Exception
	{
		// your code goes here
		FastReader sc=new FastReader();
		    String s=sc.next();char ch[]=s.toCharArray();int n=s.length(),a[]=new int[n],i;
		    for(i=0;i<n;i++)
		       a[i]=1;
		    for(i=0;i<n;i++){
		        if(ch[i]=='9' && a[i]!=0){
		            ch[i]='1';a[i]=0;
		        }
		        else if(ch[i]=='1' && a[i]!=0){
		            ch[i]='9';a[i]=0;
		        }
		    }
		     for(i=0;i<n;i++)
		       System.out.print(ch[i]);
		      System.out.println();
	}
	 static class FastReader{
          BufferedReader in;
          StringTokenizer st;
          public FastReader(){
              in=new BufferedReader(new InputStreamReader(System.in));
          }
          String next(){
              while(st==null || !st.hasMoreElements()){
                  try{
                      st=new StringTokenizer(in.readLine());
                  }
                  catch(IOException e){
                      e.printStackTrace();
                  }
               }
               return st.nextToken();
            }
            int nextInt(){
                return Integer.parseInt(next());
            }
            long nextLong(){
                return Long.parseLong(next());
            }
            double nextDouble(){
                return Double.parseDouble(next());
            }
            String nextLine(){
            String str19 = "";
            try{
                str19 = in.readLine();
            }
            catch (IOException e){
                e.printStackTrace();
             }
            return str19;
        }
      }    
}
