from collections import Counter, deque

from fractions import gcd

from functools import lru_cache

from functools import reduce

import functools

import heapq

import itertools

import math

import numpy as np

import sys



sys.setrecursionlimit(10000)

INF = float('inf')



S = eval(input())

print((S.replace('1', 'a').replace('9', '1').replace('a', '9')))

import os

import sys



if os.getenv("LOCAL"):

    sys.stdin = open("_in.txt", "r")



sys.setrecursionlimit(10 ** 9)

INF = float("inf")

IINF = 10 ** 18

MOD = 10 ** 9 + 7

# MOD = 998244353



n = sys.stdin.buffer.readline().decode().rstrip()

for a in n:

    if a == '9':

        print(1, end='')



    if a == '1':

        print(9, end='')

print()

from collections import Counter, deque
from fractions import gcd
from functools import lru_cache
from functools import reduce
import functools
import heapq
import itertools
import math
import numpy as np
import sys

sys.setrecursionlimit(10000)
INF = float("inf")
S = eval(input())
print((S.replace("1", "a").replace("9", "1").replace("a", "9")))

import os
import sys

if os.getenv("LOCAL"):
    sys.stdin = open("_in.txt", "r")
sys.setrecursionlimit(10**9)
INF = float("inf")
IINF = 10**18
MOD = 10**9 + 7
# MOD = 998244353
n = sys.stdin.buffer.readline().decode().rstrip()
for a in n:
    if a == "9":
        print(1, end="")
    if a == "1":
        print(9, end="")
print()

-from collections import Counter, deque -from fractions import gcd -from functools import lru_cache -from functools import reduce -import functools -import heapq -import itertools -import math -import numpy as np +import os -sys.setrecursionlimit(10000) +if os.getenv("LOCAL"): +    sys.stdin = open("_in.txt", "r") +sys.setrecursionlimit(10**9) -S = eval(input()) -print((S.replace("1", "a").replace("9", "1").replace("a", "9"))) +IINF = 10**18 +MOD = 10**9 + 7 +# MOD = 998244353 +n = sys.stdin.buffer.readline().decode().rstrip() +for a in n: +    if a == "9": +        print(1, end="") +    if a == "1": +        print(9, end="") +print()