Harryxun/stf_run huggingface dataset:
a,b,c,d,e,f = map(int, input().split())

dp=[-1]*(f + 1)
dp[0]=0
for i in range(f+1):
  if dp[i] == -1:
    continue
  for j in [a, b]:
    water = i + 100*j
    if water > f:
      continue
    dp[water] = 0
    salt_max = water * e / 100
    dd = int(salt_max - dp[i])
    dp_s = [0] * (dd + 1)
    dp_s[0] = 1
    for pp in range(dd + 1):
      if dp_s[pp] == 0:
        continue
      for k in [c, d]:
        if pp+k > dd:
          continue
        dp_s[pp+k] = 1
    sm = 0
    for index,dp_i in enumerate(dp_s):
      if dp_i != 0:
        sm = index
    if water + sm + dp[i] <= f:
      dp[water] = max(dp[water], sm + dp[i])

for i in range(f+1):
  if dp[i] > 0:
    ans = i
print(dp[ans] + ans, dp[ans])

### FIXED CODE ###

a,b,c,d,e,f = map(int, input().split())

per = 0.0
ans = salt = w = s = 0
for i in range(0, f + 1, 100 * a):
    for j in range(0, f + 1, 100 * b):
        w = i + j
        if w > f: break
        for k in range(0, f + 1, c):
            if w + k > f: break
            for l in range(0, f + 1, d):
                w = i + j
                s = k + l
                if w + s > f: break
                if s <= (w // 100) * e:
                    if 0 < s + w <= f:
                        if per < s / (s + w):
                            per = s / (s + w)
                            ans = w + s
                            salt = s
if ans == 0:
    print(100*a,0)
else:
    print(ans,salt)
a,b=input().split("
                  ")
if (a[0]==b[2] and a[1]==b[1] and a[2]==b[0]):
  print("YES")
else:
  print("NO")


### FIXED CODE ###

a=input()
b=input()
if (a[0]==b[2] and a[1]==b[1] and a[2]==b[0]):
  print("YES")
else:
  print("NO")
k = int(input())
a, b = map(int, input().split())

if k < a:
  if k >= 2:
    if b - a >= k - 2:
    print("OK")
elif k == a or k == b:
  print("OK")
elif a < k  and k < b:
  print("OK")
print k == 1:
  print("OK")
else:
  print("NO")


### FIXED CODE ###

k = int(input())
a, b = map(int, input().split())

if b - a >= k - 1:
  print("OK")
elif  k == 1:
  print("OK")
elif b == k or a == k:
  print("OK")
elif b % k == 0 or a % k == 0:
  print("OK")
elif a < k and k < b:
  print("OK")
elif a != b and k == 2:
  print("OK")
elif b < k:
  print("NG")
elif a % k > b % k:
  print("OK")
else:
  print("NG")
from itertools import accumulate
N, M, K = map(int,input().split())
A_list = [0] + list(map(int,input().split()))
B_list = [0] + list(map(int,input().split()))
A_sums_list = list(accumulate(A_list))
B_sums_list = list(accumulate(B_list))

for n in range(N + 1):
    if A_sums_list[n] > K:
        break
    A_max = n
for m in range(M + 1):
    if B_sums_list[m] > K:
        break
    B_max = m
ans = max(A_max, B_max)

for i in reversed(range(A_max + 1)):
    for j in reversed(range(ans - i + 2)):
        if i + j > ans:
            if A_sums_list[i] + B_sums_list[j] <= K:
                ans = i + j
                break
        else:
            break
print(ans)

### FIXED CODE ###

import itertools
n, m, k = map(int, input().split())
a = [0] + list(map(int, input().split()))
b = [0] + list(map(int, input().split()))

sa = list(itertools.accumulate(a))
sb = list(itertools.accumulate(b))

output = 0
j = m
for i in range(n + 1):
    if sa[i] > k:
        break
    while sa[i] + sb[j] > k:
        j -= 1
    if output < i + j:
        output = i + j
print(output)
a, b = map(int, input())
if b % a == 0:
  print(a+b)
else:print(b-a)
  

### FIXED CODE ###

a, b = map(int, input().split())
if b % a == 0:
  print(a+b)
else:print(b-a)
import sys
sys.setrecursionlimit(100000000000000)

def answer():
    input = sys.stdin.readline
    M = int(input())

    part = ''
    for i in range(M):
        d, c = input().split()
        part += d * int(c)

    _round = 0
    while len(part) > 1:
        _round += 1
        # 和10以上を探索
        mt10 = 0
        for i in range(1, len(part)):
            s1 = part[-i]
            s2 = part[-i-1]
            if int(s1) + int(s2) >= 10:
                mt10 = - i - 1
                break

        if mt10 == 0:
            s1 = part[0]
            s2 = part[1]
            s3 = part[2:]
            part = str(int(s1) + int(s2)) + s3
        else:
            s1 = part[:mt10]
            s2 = part[mt10]
            s3 = part[mt10+1]
            s4 = ''
            if mt10 < -2:
                s4 = part[mt10+2:]
            part = s1 + str(int(s2)+int(s3)) + s4

    print(_round)


if __name__ == '__main__':
    answer()


### FIXED CODE ###

import sys

def answer():
    input = sys.stdin.readline
    M = int(input())

    Ds = [0] * M
    Cs = [0] * M
    total = 0

    for i in range(M):
        c, d = map(int, input().split())
        Cs[i] = c
        Ds[i] = d
        total += d * c

    digits = sum(Ds)

    ans = (digits-1) + (total-1) // 9

    print(ans)


if __name__ == '__main__':
    answer()
import sys
from bisect import bisect_left, bisect_right
from copy import deepcopy
def input(): return sys.stdin.readline().strip()


def main():
    N = int(input())
    A = list(map(int, input().split()))
    repn = [[] for _ in range(N)]
    for _ in range(N - 1):
        u, v = map(int, input().split())
        repn[u - 1].append(v - 1)
        repn[v - 1].append(u - 1)
    
    length = [0] * (N + 1)
    dp = [-1]

    """
    やはり各頂点でLIS配列を取ると配列コピーの時間がかかってTLEするので、
    配列は唯一つを扱って、DFSからバックするときに配列も元に戻す操作を行いたい
    （ここの実装の仕方がわからなかった）

    これはdfsを再帰で書いた後に復元操作を追記すれば異常に楽に書ける。。。
    """

    def dfs(v, p=N):
        if A[v] > dp[-1]:
            dp.append(A[v])
            length[v] = length[p] + 1
            for u in repn[v]:
                if u == p: continue
                dfs(u, v)
            dp.pop()
        else:
            idx = bisect_right(dp, A[v])
            old = dp[idx]
            dp[idx] = A[v]
            length[v] = length[p]
            for u in repn[v]:
                if u == p: continue
                dfs(u, v)
            dp[idx] = old
        #print("v={}, len={}, dp={}".format(v, length[v], dp))

    dfs(0)
    length.pop()
    for ans in length:
        print(ans)




if __name__ == "__main__":
    main()


### FIXED CODE ###

import sys
from bisect import bisect_left, bisect_right
sys.setrecursionlimit(2*10**5)
def input(): return sys.stdin.readline().strip()


def main():
    N = int(input())
    A = list(map(int, input().split()))
    repn = [[] for _ in range(N)]
    for _ in range(N - 1):
        u, v = map(int, input().split())
        repn[u - 1].append(v - 1)
        repn[v - 1].append(u - 1)
    
    length = [0] * (N + 1)
    dp = [-1]

    """
    やはり各頂点でLIS配列を取ると配列コピーの時間がかかってTLEするので、
    配列は唯一つを扱って、DFSからバックするときに配列も元に戻す操作を行いたい
    （ここの実装の仕方がわからなかった）

    これはdfsを再帰で書いた後に復元操作を追記すれば異常に楽に書ける。。。
    """

    def dfs(v, p=N):
        if A[v] > dp[-1]:
            dp.append(A[v])
            length[v] = length[p] + 1
            for u in repn[v]:
                if u == p: continue
                dfs(u, v)
            dp.pop()
        else:
            length[v] = length[p]
            idx = bisect_left(dp, A[v]) # bisect_rightだとdpに重複する値を書き込んでしまうのでダメ
            old = dp[idx]
            dp[idx] = A[v]
            for u in repn[v]:
                if u == p: continue
                dfs(u, v)
            dp[idx] = old
        #print("v={}, len={}, dp={}".format(v, length[v], dp))

    dfs(0)
    length.pop()
    for ans in length:
        print(ans)
    


if __name__ == "__main__":
    main()
B=[];bingo=0
import numpy as np
A=np.zeros((3,3),dtype=int)
for i in range(3):
  a,b,c=map(int,input().split())
  A[i][0]=a
  A[i][1]=b
  A[i][2]=c
N=int(input())
for i in range(N):
  B.append(int(input()))
#print(A)
#print(B)
for i in range(3):
  for j in range(3):
    for k in range(N):
      if A[i][j]==B[k]:
        A[i][j]=0
#print(A)
for i in range(3):
  if sum(A[i][:])==0:
    bingo=bingo+1
for i in range(3):
  if sum(A[0][i])==0 or sum(A[1][i])==0 or sum(A[2][i])==0:
    bingo=bingo+1
if A[0][0]+A[1][1]+A[2][2]==0:
  bingo=bingo+1
if A[2][0]+A[1][1]+A[0][2]==0:
  bingo=bingo+1
print("Yes" if bingo>=1 else "No")
print(sum(A[:][1]))
print(sum(A[1][:]))
print(bingo)

### FIXED CODE ###

B=[];bingo=0
import numpy as np
A=np.zeros((3,3),dtype=int)
for i in range(3):
  a,b,c=map(int,input().split())
  A[i][0]=a
  A[i][1]=b
  A[i][2]=c
N=int(input())
for i in range(N):
  B.append(int(input()))
#print(A)
#print(B)
for i in range(3):
  for j in range(3):
    for k in range(N):
      if A[i][j]==B[k]:
        A[i][j]=0
#print(A)
for i in range(3):
  if sum(A[i][:])==0:
    bingo=bingo+1
for i in range(3):
  if A[0][i]+A[1][i]+A[2][i]==0:
    bingo=bingo+1
if A[0][0]+A[1][1]+A[2][2]==0:
  bingo=bingo+1
if A[2][0]+A[1][1]+A[0][2]==0:
  bingo=bingo+1
print("Yes" if bingo>=1 else "No")
import math
from functools import reduce

def lcm(x, y):
    return (x * y) // math.gcd(x, y)

def lcm_ls(num):
    return reduce(lcm, num, 1)


n = int(input())
ls = list(map(int, input().split()))

m = lcm_ls(ls)

ans = 0

for i in range(n):
    ans += m // ls[i]

print(ans % (10 ** 9 + 7))

### FIXED CODE ###

import fractions
from functools import reduce

def lcm(x, y):
    return (x * y) // fractions.gcd(x, y)

def lcm_ls(num):
    return reduce(lcm, num, 1)


n = int(input())
ls = list(map(int, input().split()))

m = lcm_ls(ls)

ans = 0

for i in range(n):
    ans += m // ls[i]

print(ans % (10 ** 9 + 7))
n,k=map(int,input().split())
a=list(map(int,input().split()))

rui=[0]
for i in a:
  rui.append(rui[-1]+i)
hantei=0
for i in range(1,len(rui)-k):
  if hantei<=rui[i+k]-rui[i]:
    hantei=rui[i+k]-rui[i]
    l=i
    r=i+k
ans=0
for i in range(l,r):
  ans+=(a[i]+1)/2
  
print(ans)

### FIXED CODE ###

from itertools import accumulate
N, K = list(map(int, input().split()))
C = list(map(int, input().split()))
A=[]
for i in range(N):
  A.append((C[i]+1)/2)
B = [0] + A
B = list(accumulate(B))

ans = []
for i in range(N-K+1):
    ans.append(B[i+K]-B[i])
print(max(ans))
import math
a = input()
b = input()
x = (int(a) + int(b)) / 2
print(math.ceil(x))

### FIXED CODE ###

import math
a,b=map(int,input().split())
x = (int(a) + int(b)) / 2
print(math.ceil(x))
N = int(input())
A = []
for i in range(N):
	A.append(int(input()))

max_A = max(A)

num = [0] * (max_A + 1)

for i in range(N):
	num[A[i]] += 1

sum = 0
for i in range(len(num)):
	if num[i] % 2 == 1:
		sum += 1

print(sum)

### FIXED CODE ###

N = int(input())
A = []
for i in range(N):
	A.append(int(input()))

A.sort()

i = 0

ans = 0

while i != len(A):
	num = A[i]
	count = 0
	j = i
	while A[j] == num:
		count += 1
		j += 1
		if j == len(A):
			break

	if count % 2 == 1:
		ans += 1
	i += count
	
print(ans)
N = int(input())
S = input()

ans = ""

for x in range(S)
	num=(ord(x) + N)
  	if num >90:
    	num=64+num%90
    ans += chr(num)
print(ans)



### FIXED CODE ###

n = int(input())
s = input()
n_s = ""
for i in range(len(s)):
    if ord(s[i])+n > 90:
        n_s+=chr(ord(s[i])+n-26)
    else:
        n_s+=chr(ord(s[i])+n)
    
print(n_s)
a=list(map(int,input()).split())
if sum(a)/2==max(a):print("YES")
else:print("NO")

### FIXED CODE ###

a=list(map(int,input().split()))
if sum(a)/2==max(a):print("Yes")
else:print("No")
s = input()
s[0:3] = "2018"

print(s)

### FIXED CODE ###

s = input()
s = s.replace("2017","2018")
 
print(s)
import numpy as np
N = int(input())
B = input()

B_array = np.array(list(map(int, list(B))))
B_1 = B_array.sum()
mod_list_m1 = []
mod_list = []
mod_list_p1 = []
if B_1 == 1:
    for i in range(N):
        print(0)
else:
    for i in range(N):
        mod_list.append((2**i) % (B_1))
        mod_list_m1.append((2**i) % (B_1-1))
        mod_list_p1.append((2**i) % (B_1+1))
    mod_list = np.array(mod_list)[::-1]
    mod_list_m1 = np.array(mod_list_m1)[::-1]
    mod_list_p1 = np.array(mod_list_p1)[::-1]

    mod_m1 = B_array.dot(mod_list_m1) % (B_1-1)
    mod_p1 = B_array.dot(mod_list_p1) % (B_1+1)
    print(mod_m1)

    def calc_small(n, iter):
        iter += 1
        mod = n % bin(n).count("1")
        if mod == 0:
            return iter
        else:
            return calc_small(mod, iter)

    for i in range(N):
        mod = (mod_m1 - mod_list_m1[i]) % (B_1-1) if B_array[i] == 1 else (mod_p1 + mod_list_p1[i]) % (B_1+1)
        iter = 1
        if mod == 0:
            print(iter)
        else:
            print(calc_small(mod, iter))
    




### FIXED CODE ###

N = int(input())
B = input()

B_1 = B.count("1")
mod_p1 = int(B,2) % (B_1+1)
if B_1 != 1:
    mod_m1 = int(B,2) % (B_1-1)

def calc_small(n, iter):
    iter += 1
    mod = n % bin(n).count("1")

    if mod == 0:
        return iter
    else:
        return calc_small(mod, iter)

for i in range(N):
    if B_1 == 1 and int(B[i]) == 1:
        print(0)
        continue
    mod = (mod_m1 - pow(2,N-i-1,B_1-1)) % (B_1-1) if int(B[i]) == 1 else (mod_p1 + pow(2,N-i-1,B_1+1)) % (B_1+1)
    iter = 1
    if mod == 0:
        print(iter)
    else:
        print(calc_small(mod, iter))
s=list(input().split())

for i in range(len(s)):
  if i=='A':
    a=i
  if i=='Z':
    z=i
print(z-a+1)

### FIXED CODE ###

s=list(input())
a=200000
z=0

for i in range(len(s)):
  if s[i]=='A'and a>i:
    a=i
  if s[i]=='Z'and z<i:
    z=i
print(z-a+1)
n,k=map(int,input().split)
a=[]
c=[]
for i in range(n):
    b=int(input())
    a.append(b)
sorted(a)
for u in range(n-1):
    d=a[u+k-1]-a[u]
    c.append(d)
print(min(c))

### FIXED CODE ###

n,k = map(int,input().split())
a=[]
c=[]
for i in range(n):
    b=int(input())
    a.append(b)
a.sort()
for u in range(n-k+1):
    d=a[u+k-1]-a[u]
    c.append(d)
print(min(c))
N,L = map(int,input().split())
S = [input() for i in range(N)]
print("".join(S.sort()))

### FIXED CODE ###

N,L = map(int,input().split())
S = [input() for i in range(N)]
S.sort()
print("".join(S))
import sys

fin = sys.stdin.readline
num = str(int(fin()))

readable = True
prev_num = num[0]
for i in range(1, 4):
    cur_num = num[i]
    if prev_num == cur_num:
        readable = False
    prev_num = cur_num

if readable:
    print('Good')
else:
    print('Bad')


### FIXED CODE ###

import sys

fin = sys.stdin.readline
num = str(fin()).split()[0]

readable = True
prev_num = num[0]
for i in range(1, 4):
    cur_num = num[i]
    if prev_num == cur_num:
        readable = False
    prev_num = cur_num

if readable:
    print('Good')
else:
    print('Bad')
import math
from functools import reduce
N = int(input())
Alist = list(map(int, input().split()))
def gcd(numbers):
    return  reduce(math.gcd, numbers)
print(max([gcd(Alist[:i]+Alist[i+1:]) for i in range(N)]))

### FIXED CODE ###

from fractions import gcd
N = int(input())
Alist = [0]+list(map(int, input().split()))+[0]
Rlist = [0]*(N+2)
Llist = [0]*(N+1)
for i in range(N):
    Llist[i+1] = gcd(Llist[i], Alist[i])
    Rlist[N-i] = gcd(Rlist[N-i+1], Alist[N-i+1])
print(max([gcd(Rlist[i], Llist[i]) for i in range(1,N+1)]))
a,b,c=input().split()
if (int(b)-int(a)==(int(c)-int(b):
	print("YES")
else:
	print("NO")

### FIXED CODE ###


a,b,c=input().split()
if (int(b)-int(a))==(int(c)-int(b)):
	print("YES")
else:
	print("NO")
n=map(int,input().split())
s=input()
l1,r1=map(int,input().split())
l2,r2=map(int,input().split())
l3,r3=map(int,input().split())

s1=s[(l1-1):r1]
s2=s[(l2-1):r2]
s3=s[(l3-1):r3]

print(s1.count("AC"))
print(s2.count("AC"))
print(s3.count("AC"))

### FIXED CODE ###

n,q=map(int,input().split())
s=input()
lr = [list(map(int, input().split())) for _ in range(q)]

ruisekiwa=[0]*n
for i in range(n-1):
    if s[i]=="A" and s[i+1]=="C":
        ruisekiwa[i+1]=ruisekiwa[i]+1
    else:
        ruisekiwa[i+1] = ruisekiwa[i]
for i in range(q):
    print(ruisekiwa[lr[i][1]-1]-ruisekiwa[lr[i][0]-1])
import math
from functools import reduce
def gcd_list(numbers):
    return reduce(math.gcd, numbers)
n = int(input())
a = list(map(int,input().split()))
print(gcd_list(a))

### FIXED CODE ###

import fractions
from functools import reduce
def gcd_list(numbers):
    return reduce(fractions.gcd, numbers)
n = int(input())
a = list(map(int,input().split()))
print(gcd_list(a))
H, W = map(int, input().split())
S = ['.'+input()+'. ' for _ in range(H)]

S.insert(0, '.'*(W+2))
S.insert(H+1, '.'*(W+2))

for i in range(1, W+1):
    for j in range(1, H+1):
        if S[i][j]=='#':
            if S[i+1][j]=='.' and S[i-1][j]=='.' and S[i][j+1]=='.' and S[i][j-1]=='.':
                print('No')
                break
            
print('Yes')

### FIXED CODE ###

H, W = map(int, input().split())
S = ['.'+input()+'. ' for _ in range(H)]

S.insert(0, '.'*(W+2))
S.insert(H+1, '.'*(W+2))

flg = 0
for i in range(1, H+1):
    for j in range(1, W+1):
        if S[i][j]=='#':
            if S[i+1][j]=='.' and S[i-1][j]=='.' and S[i][j+1]=='.' and S[i][j-1]=='.':
                flg = 1
                break
    else:
        continue
    break
    
if flg==0:
    print('Yes')
else:
    print('No')
n=int(input())
lst={}
for i in range(n):
 lst.extend(input().split())
list_uniq={}
ans=0
for j in lst:
 if list_uniq.count(j)==0:
    list_uniq.append(j)
    ans+=1
 else:
    pass
print(ans)

### FIXED CODE ###

n=int(input())
lst={}
for i in range(n):
  lst[input()]=1
print(len(lst))
N = int(input())
A = list(map(int, input().split()))
count = 0
up = 0
down = 0
before = A[0]
tmp = 0
for i in range(1,N):
  tmp = A[i]
  if (up == 0) and (down == 0):
    if tmp > before:
      up = 1
      before = tmp
    elif tmp < before:
      down = 1
      before = tmp
    else:
      continue
  elif up == 1:
    if tmp < before:
      count += 1
      up = 0
      before = tmp
  elif down = 1:
    if tmp > before:
      count += 1
      down = 0
      before = tmp
count += 1
print(count)
      


### FIXED CODE ###

N = int(input())
A = list(map(int, input().split()))
count = 0
up = 0
down = 0
before = A[0]
tmp = 0
for i in range(1,N):
  tmp = A[i]
  if (up == 0) and (down == 0):
    if tmp > before:
      up = 1
      before = tmp
    elif tmp < before:
      down = 1
      before = tmp
    else:
      continue
  elif up == 1:
    if tmp < before:
      count += 1
      up = 0
      before = tmp
    else:
      before = tmp
  elif down == 1:
    if tmp > before:
      count += 1
      down = 0
      before = tmp
    else:
      before = tmp
count += 1
print(count)
n=int(input())
s=input()
t=input()
a=""
for i in range(n):
    a+=s[n-1]
    a+=t[n-1]
print(a)


### FIXED CODE ###

n=int(input())
u=list(input().split())
s=list(u[0])
t=list(u[1])
a=""
for i in range(n):
    a+=s[i]
    a+=t[i]
print(a)
W,H,x,y,r = list(map(int,input().split()))
 if 0 <= x - r or x - r < x + r:
  print('yes')
 elif 0 <= y - r or y - r <= y + r:
  print('yes')
 else:
  print('no')

### FIXED CODE ###

W, H, x, y, r = list(map(int, input().split()))
print('Yes' if 0 <= x - r <= x + r <= W and 0 <= y - r <= y + r <= H else 'No')
s = str(input())
n = len(s)
s = s.rstrip(s[n-1])
for i in range(n):
	a = len(s)
	if (a % 2) == 0:
		ss = s[0:a//2]
		if s.count(ss) == 2:
			print(a)
			break
		else:
			s = s.rstrip(s[a-1])
	else:
		s = s.rstrip(s[a-1])

### FIXED CODE ###

s = input()
n = len(s)
check = True
i = 2
while check:
    if s[0:(n-i)//2] == s[(n-i)//2:(n-i)]:
        check = False
    else:
        i += 2
print(n-i)
if N%2 == 0:
  print(N/2)
else:
  print(ceil(N/2))

### FIXED CODE ###

N = int(input())
if N % 2 == 0:
  n = N / 2
else:
  n = int((N+1) / 2)
print(int(n))
import sys
n = int (input())
words = []
No=" "
for i in range (n) :
    words.append(input())
for x in range(len(words)):
    if words.count(words[x]) > 1 or words[x+1][0] != words[x][-1]:
        No="No"
        print (No)
        sys.exit() 
If No != "No":
     print ("Yes")

### FIXED CODE ###

num=int(input())
list1=[]
flag=0
j=0

for i in range(num):

    a=input()



    if a in list1:
        flag+=1
    list1.append(a)
    if j>0:
        if list1[i-1][len(list1[i-1])-1]==list1[i][0]:
           pass

        else:
          flag+=2

    j=1

if flag>0:
    print("No")
else:
    print("Yes")
a,b = map(int, input().split())
if (a+b) <= 9:
  print(a+b)
else;
  print("error")

### FIXED CODE ###

a,b = map(int, input().split())
if a+b >= 10:
  print("error")
else:
  print(a+b)
a,b,c,d = map(int, input().open().read().split())
print(sum(500*x+100*y+50*z==d for x in range(a+1) for y in range(b+1) for z in range(c+1)))

### FIXED CODE ###

a,b,c,d = map(int, open(0))
print(sum(500*x+100*y+50*z==d for x in range(a+1) for y in range(b+1) for z in range(c+1)))
n = int(input())

n_letters = str(n)

for i in n_letters:
    if n_letters[i] == "1":
        n_letters[i] = "9"
    elif n_letters[i] == "9":
        n_letters[i] = "1"


### FIXED CODE ###

n = input()
ans = []
for i in range(len(n)):
    if n[i] == '1':
        ans.append('9')
    elif n[i] == '9':
        ans.append('1')

print(''.join(ans))
N = int(input())
A = map(int, input().split())

count = 0
flag = True

while flag == True:
    for i in range(N):
        if A[i]%2 == 0:
            A[i] /= 2

        else:
            flag = False
            break

        count += 1


### FIXED CODE ###

N = int(input())
A = list(map(int, input().split()))

count = -1
flag = True

while flag == True:
    count += 1
    for i in range(N):
        if A[i]%2 == 0:
            A[i] /= 2

        else:
            flag = False
            break



print(count)
from typing import List

def is_odd(num: int) -> bool:
    return num % 2 == 0

def odd_in_list(num_list: List[int]) -> bool:
    for num in num_list:
        if is_odd(num):
            return True
    
    else:
        return False

def half(num: int) -> int:
    return num / 2

def shift_only(num_list, counter):
    if odd_in_list(num_list):
        return counter
    else:
        return shift_only(list(map(half, num_list)), counter + 1)


n = int(input())

a_list = list(map(int, input().split()))

counter = 0

result = shift_only(a_list, counter)
print(result)

### FIXED CODE ###



def is_odd(num):
    return num % 2 != 0

def odd_in_list(num_list):
    for num in num_list:
        if is_odd(num):
            return True
    
    return False

def half(num):
    return num / 2

def shift_only(num_list, counter):
    if odd_in_list(num_list):
        print('its over')
        return counter
    else:
        new_list = list(map(half, num_list))
        counter += 1
        print('continue', num_list, counter)
        return shift_only(new_list, counter)


n = int(input())

a_list = list(map(int, input().split()))


counter = 0
flag = True

while flag:
    for i in range(n):
        # print(a_list[i])
        if a_list[i] % 2 != 0:
            # print('is odd')
            flag = False
            break
        else:
            continue
    
    if not flag:
        break
    
    for i in range(n):
        a_list[i] /= 2
    counter += 1

    # print('-----loop------')
    # print(a_list, counter)

print(counter)