import java.util.*;
class Main
{
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String s=sc.next();
		StringBuffer sb = new StringBuffer();
		int len=s.length();
		for(int i=0;i<len;i++)
		{
			if(s.charAt(i)=='1')
				sb.append('9');
			else if(s.charAt(i)=='9')
				sb.append('1');
			else
				sb.append(s.charAt(i));
		}
		System.out.println(sb);
	}
} import java.util.*; util.* java class Main
{
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String s=sc.next();
		StringBuffer sb = new StringBuffer();
		int len=s.length();
		for(int i=0;i<len;i++)
		{
			if(s.charAt(i)=='1')
				sb.append('9');
			else if(s.charAt(i)=='9')
				sb.append('1');
			else
				sb.append(s.charAt(i));
		}
		System.out.println(sb);
	}
} Main public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String s=sc.next();
		StringBuffer sb = new StringBuffer();
		int len=s.length();
		for(int i=0;i<len;i++)
		{
			if(s.charAt(i)=='1')
				sb.append('9');
			else if(s.charAt(i)=='9')
				sb.append('1');
			else
				sb.append(s.charAt(i));
		}
		System.out.println(sb);
	} main {
		Scanner sc = new Scanner(System.in);
		String s=sc.next();
		StringBuffer sb = new StringBuffer();
		int len=s.length();
		for(int i=0;i<len;i++)
		{
			if(s.charAt(i)=='1')
				sb.append('9');
			else if(s.charAt(i)=='9')
				sb.append('1');
			else
				sb.append(s.charAt(i));
		}
		System.out.println(sb);
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String s=sc.next(); s sc.next() sc.next sc StringBuffer sb = new StringBuffer(); sb new StringBuffer() int len=s.length(); len s.length() s.length s for(int i=0;i<len;i++)
		{
			if(s.charAt(i)=='1')
				sb.append('9');
			else if(s.charAt(i)=='9')
				sb.append('1');
			else
				sb.append(s.charAt(i));
		} int i=0; int i=0; i 0 i<len i len i++ i++ i {
			if(s.charAt(i)=='1')
				sb.append('9');
			else if(s.charAt(i)=='9')
				sb.append('1');
			else
				sb.append(s.charAt(i));
		} {
			if(s.charAt(i)=='1')
				sb.append('9');
			else if(s.charAt(i)=='9')
				sb.append('1');
			else
				sb.append(s.charAt(i));
		} if(s.charAt(i)=='1')
				sb.append('9');
			else if(s.charAt(i)=='9')
				sb.append('1');
			else
				sb.append(s.charAt(i)); s.charAt(i)=='1' s.charAt(i) s.charAt s i '1' sb.append('9') sb.append sb '9' if(s.charAt(i)=='9')
				sb.append('1');
			else
				sb.append(s.charAt(i)); s.charAt(i)=='9' s.charAt(i) s.charAt s i '9' sb.append('1') sb.append sb '1' sb.append(s.charAt(i)) sb.append sb s.charAt(i) s.charAt s i System.out.println(sb) System.out.println System.out System System.out sb String[] args args
import java.util.*;
class Main
{
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String s=sc.next();
		StringBuffer sb = new StringBuffer();
		int len=s.length();
		for(int i=0;i<len;i++)
		{
			if(s.charAt(i)=='1')
				sb.append('9');
			else if(s.charAt(i)=='9')
				sb.append('1');
			else
				sb.append(s.charAt(i));
		}
		System.out.println(sb);
	}
}