Harryxun/stf_run huggingface dataset:
S,T = map(input().split())
X,Y = map(int,input().split())
Z = input()
if S==Z or T==Z:
    print(X+Y-1)
else:
    print(X+Y)


### FIXED CODE ###

S,T = map(str,input().split())
X,Y = map(int,input().split())
Z = input()
if S==Z:
  print(X-1,Y)
elif T==Z:
    print(X,Y-1)
else:
    print(X,Y)
a,b=input().split()
k=(a+b)/2
g=int(k)
if(k==g):
    print(k)
else:
    print("IMPOSSIBLE")

### FIXED CODE ###

l=list(map(int,input().rstrip().split()))
a=l[0]
b=l[1]
k=(a+b)/2
g=int(k)
if(k==g):
    print(g)
else:
    print("IMPOSSIBLE")
a=sorted(set(input())^set(map(chr(range(97,123)))));print(a and a[0]or None)

### FIXED CODE ###

a=sorted(set(input())^set(chr(i)for i in range(97,123)));print(a and a[0]or None)
s = input()
x,y = map(int,s)

while(x != y or x!=1 or y != 1)
    if(x < y):
        tmp = x
        x = y
        y = tmp

    x %= y
print(x)

### FIXED CODE ###

s = input()
x,y = map(int,s.split())

while(x != y or x>1 or y > 1):
    if(x < y):
        tmp = x
        x = y
        y = tmp
    if( y == 0):
        break

    x %= y
print(x)
l = input()
m = input()
z = l.split(' ')
M = int(z[1])
N = int(z[0])
F = m.split(' ')
X = []
for item in F:
  votes = int(item)
  X.append(votes)
S = sum(S)
C = (S/(4*M))
X.sort(reverse=True)
if X[M-1]<C:
  print("No")
else:
  print("Yes")

### FIXED CODE ###

l = input()
m = input()
z = l.split(' ')
M = int(z[1])
N = int(z[0])
F = m.split(' ')
X = []
 
for item in F:
  votes = int(item)
  X.append(votes)

S = sum(X)
C = (S/(4*M))
X.sort(reverse=True)
if X[M-1]<C:
  print("No")
else:
  print("Yes")
N=int(input())
h=list(map(int,input().split()))
p=h[0]
for i in range(N-1):
  if h[i]<h[i+1]:
    p=h[i+1]
  else:
    p=p

q=1
r=0
if p==0:
    print(0)
else:
   while q<=p:
        if h[0]>=q:
            r=r+1
        else:
            r=r
        for i in range(N-1):
              if h[i]<q and h[i+1]>=q:
                r=r+1
              else:
                r=r
    q=q+1

print(r)

### FIXED CODE ###

N=int(input())
h=list(map(int,input().split()))
p=h[0]
for i in range(N-1):
  if p<h[i+1]:
    p=h[i+1]
  else:
    p=p
 
q=1
r=0
if p==0:
    print(0)
else:
    while q<=p:
        if h[0]>=q:
            r=r+1
        else:
            r=r
        for i in range(N-1):
              if h[i]<q and h[i+1]>=q:
                r=r+1
              else:
                r=r
        q=q+1
    print(r)
N = int(input())
XU=list(input().split() for i in range(int(input())))
print(sum([float(x)*{"JPY":1,"BTC":380000}[u] for x,u in XU]))

### FIXED CODE ###

XU=list(input().split() for i in range(int(input())))
print(sum([float(x)*{"JPY":1,"BTC":380000}[u] for x,u in XU]))
n,m=map(int,input().split())
a=[]
b=[]
for i in range(n):
    ai,bi=map(int,input().split())
    a.append(ai)
    b.append(bi)
    for ii in range(i-1):
        if ai<a[ii]:
            a.insert(ii)=ai
            b.insert(ii)=bi
            break
        else:
            a.append(ai)
            b.append(bi)
print(ai)
  

### FIXED CODE ###

n,m=map(int,input().split())
ab=[]
for i in range(n):
    abi=list(map(int,input().split()))
    ab.append(abi)
ab.sort()
msum=0
asum=0
for i in range(n):
    ai,bi=ab[i]
    asum=asum+ai*bi
    msum=msum+bi  
    if msum>=m:
        break
asum=asum-ai*(msum-m)
print(asum)
from sys import stdin
import sys
import collections

sys.setrecursionlimit(4100000)
N=int(input())
xlist=[]
ylist=[]
for i in range(N):
  x, y = map(int, stdin.readline().rstrip().split())
  xlist.append(x)
  ylist.append(y)

tupleList=[]
for i in range(N):
  for j in range(N):
    if i != j:
      tupleList.append((xlist[i] - xlist[j], ylist[i] - ylist[j]))

c = collections.Counter(tupleList)
print(N-max(c.values()))


### FIXED CODE ###

from sys import stdin

N=int(input())
xlist=[]
ylist=[]
dict = {}
for i in range(N):
  x, y = map(int, stdin.readline().rstrip().split())
  xlist.append(x)
  ylist.append(y)

for i in range(N):
  for j in range(N):
    if i != j:
      tupleStr=str(xlist[i] - xlist[j])+","+str(ylist[i] - ylist[j])
      if tupleStr in dict:
        dict[tupleStr]+=1
      else:
        dict[tupleStr]=1

maxNum=0
for val in dict.values():
  maxNum = max(maxNum, val)

print(N-maxNum)
def connected(G,s,t):
    checked = [False]*len(G)
    def main(G,s,t):
        if t in G[s]: return True
        checked[s] = True
        for f in G[s]:
            if checked[f]: continue
            if main(G,f,t): return True
        return False
    return main(G,s,t)


if __name__=='__main__':
    n,m = list(map(int,input().split()))
    G = [[] for _ in range(n)]
    for _ in range(m):
        s,t = list(map(int,input().split()))
        G[s].append(t)
        G[t].append(s)
    q = int(input())
    for _ in range(q):
        s,t = list(map(int,input().split()))
        print('yes' if connected(G,s,t) else 'no')

### FIXED CODE ###

import sys
 
def make_connected_group(G):
    C = [None]*len(G)
    group = 0
    for i,p in enumerate(C):
        if p != None: continue
        friends = [i]
        while len(friends) > 0:
            f = friends.pop()
            if C[f] == None:
                C[f] = group
                friends += G[f]
        group += 1
    return C
 
 
if __name__=='__main__':
    n,m = list(map(int,sys.stdin.readline().split()))
    G = [[] for _ in range(n)]
    for j,line in enumerate(sys.stdin):
        if not j < m:
            q = int(line)
            break
        s,t = list(map(int,line.split()))
        G[s].append(t)
        G[t].append(s)
    C = make_connected_group(G)
    for j,line in enumerate(sys.stdin):
        if not j < q: break
        s,t = list(map(int,line.split()))
        print('yes' if C[s] == C[t] else 'no')
A, B, C, D = [int(_) for _ in input().split()]

import math
def dvi_num(b, c):
    return math.floor(b / c)

def lcm(a, b):
    return a * b / math.gcd(a, b)

def dvi_num2(b, c, d):
    return b - dvi_num(b,c) - dvi_num(b,d) + dvi_num(b, lcm(c, d))

ans = dvi_num2(B, C, D) - dvi_num2(A - 1, C, D)
print([dvi_num2(B, C, D), dvi_num2(A - 1, C, D)])

print(ans)

### FIXED CODE ###

A, B, C, D = [int(_) for _ in input().split()]

def gcd(a,b):
    while b != 0:
        a, b = b, a%b
    return a

def lcm(a, b):
    return a * b // gcd(a, b)

def dvi_num2(b, c, d):
    return b - b // c - b //d + b // lcm(c, d)

ans = dvi_num2(B, C, D) - dvi_num2(A - 1, C, D)
print(int(ans))
from collections import Counter

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

    
c = Counter(A)


ans = []
for i, j in c.items():
    if j >= 2:
        ans.append[i]

ans.sort()    
print(ans[-1]*ans[-2])

### FIXED CODE ###

import collections
N = int(input())
A = list(map(int, input().split()))
a = collections.Counter(A)
ans = [0, 0]
for i in a.keys():
    if a[i] >= 2:
        ans.append(i)
    if a[i] >= 4:
        ans.append(i)
ans.sort()
print(ans[-1]*ans[-2])
import numpy as np


def parse():
    n, k = map(int, input().split())
    p = list(map(int, input().split()))
    c = list(map(int, input().split()))
    pc = {i: (pi - 1, ci) for i, (pi, ci) in enumerate(zip(p, c))}
    return k, pc


def split_simple():
    k, pc = parse()
    lst = [[]]
    lst[0].append(pc.pop(0))
    while True:
        if not pc:
            break
        p, _ = lst[-1][-1]
        if p in pc:
            pcj = pc.pop(p)
            lst[-1].append(pcj)
        else:
            j = next(iter(pc.keys()))
            pcj = pc.pop(j)
            lst.append([pcj])
    return k, [np.array([ls[1] for ls in lst_], dtype=np.long) for lst_ in lst]


def inner(n, k, s, sim):
    if k < n or s <= 0:
        return sim.max()
    else:
        div = k // n
        mod = k % n
        return s * div + sim[:, :mod].max()


def main():
    k, data_set = split_simple()
    result = min([d.min() for d in data_set])
    for data in data_set:
        n = data.size
        rep = np.repeat(data[None], 2, axis=0).flatten()
        sim = np.array([[rep[i:i+p].sum()
                         for p in range(1, min(k, n) + 1)] for i in range(n)])
        cand = inner(n, k, data.sum(), sim)
        result = max(result, cand)
    print(result)


if __name__ == "__main__":
    main()


### FIXED CODE ###

import numpy as np


def parse():
    n, k = map(int, input().split())
    p = list(map(int, input().split()))
    c = list(map(int, input().split()))
    pc = {i: (pi - 1, ci) for i, (pi, ci) in enumerate(zip(p, c))}
    return k, pc


def split_simple():
    k, pc = parse()
    lst = [[]]
    lst[0].append(pc.pop(0))
    while True:
        if not pc:
            break
        p, _ = lst[-1][-1]
        if p in pc:
            pcj = pc.pop(p)
            lst[-1].append(pcj)
        else:
            j = next(iter(pc.keys()))
            pcj = pc.pop(j)
            lst.append([pcj])
    return k, [np.array([ls[1] for ls in lst_], dtype=np.long) for lst_ in lst]


def inner(n, k, s, sim):
    # print(sim)
    # print(s)
    if sim.shape[1] == 1:
        return sim.max()
    if k < n or s <= 0:
        return sim.max()
    div = k // n
    mod = k % n
    # print(k, n, div, mod)
    if mod == 0:
        return max(s * div, s * (div - 1) + sim.max())
    try:
        return max(s * div + sim[:, :mod].max(), s * (div - 1) + sim[:, :mod].max())
    except ValueError:
        print(mod)
        print(sim)
        print(sim.shape)
        raise


def main():
    k, data_set = split_simple()
    result = min([d.min() for d in data_set])
    for data in data_set:
        n = data.size
        rep = np.repeat(data[None], 2, axis=0).flatten()
        # sim_ = np.array([[rep[i:i+p].sum()
        #                  for p in range(1, min(k, n) + 1)] for i in range(n)])
        sim = np.array([np.cumsum(rep[i:i+min(k, n)]) for i in range(n)])
        # print((sim == sim_).all())
        cand = inner(n, k, data.sum(), sim)
        result = max(result, cand)
    print(result)


if __name__ == "__main__":
    main()
even,odd = map(int, input().split())

def f(n):
  if n == 1 or n == 0:
    return 1
  else:
    return n*f(n-1)
  
print(int(f(even)/(f(even-2)*2) + f(odd)/(f(odd-2)*2)))

### FIXED CODE ###

even,odd = map(int, input().split())

  
print(int(even * (even-1)/2 + odd * (odd-1)/2))
s = input()
s1 = s[:s//2]
s2 = s[-(s//2):]
ans = 0
for i in range(s//2):
  if s1[i] != s2[i]:
    ans += 1
print(ans)    

### FIXED CODE ###

n = input()
s = len(n)
s1 = n[:s//2]
s2 = n[-1 * (s//2):]
s2 = s2[::-1]
ans = 0
for i in range(s//2):
  if s1[i] != s2[i]:
    ans += 1
print(ans)
n = int(input())
f = []
for _ in range(n):
    f.append(list(map(int, input().split())))
p = []
for _ in range(n):
    p.append(list(map(int, input().split())))

result = -100000000

# opening schedule for my shop.
# start from 1(only open Mon.AM) to 1023(open all day)
for b in range(1, 1<<10):

    profit = 0
    # compare with other shops
    for i in range(n):

        common_opening = 0
        # compare time
        for j in range(10):

            if 1&(b>>j) and f[i][j] == 1:
            
                common_opening += 1
        profit += p[i][common_opening]

    result = max(result, profit)

print(result)


### FIXED CODE ###

n, a, b = list(map(int, input().split()))

print(a*n if b > a*n else b)
number = list(map(int, input()))
print('{}'.format(int(number[0] * number[1])))

### FIXED CODE ###

from decimal import Decimal

C, D = map(Decimal, input().split())
print(int(C*D))
h, w = map(int, input().split())
a = [list(map(int, input().split())) for _ in range(h)]
ans = []
for j in range(0, w):
    for i in range(0, h-1):
        if a[i][j]%2 == 1:
            a[i][j] -= 1
            a[i+1][j] += 1
            ans.append([i+1, j+1, k+1, l+1])
for j in range(0, w-1):
    if a[h-1][j]%2 == 1:
        a[h-1][j] -= 1
        a[h-1][j+1] += 1
        ans.append([h-1, j, h-1, j+1])
print(len(ans))
for i in range(0, len(ans)):
    print(ans[i][0],ans[i][1],ans[i][2],ans[i][3],end="")
    print()

### FIXED CODE ###

h, w = map(int, input().split())
a = [list(map(int, input().split())) for _ in range(h)]

ans = []
ope = []
def operate(i, j, k, l):
    a[i][j] -= 1
    a[k][l] += 1
    ans.append([i+1, j+1, k+1, l+1])

for j in range(0, w):
    for i in range(0, h-1):
        if a[i][j]%2 == 1:
            operate(i, j, i+1, j)
for j in range(0, w-1):
    if a[h-1][j]%2 == 1:
        operate(h-1, j, h-1, j+1)

print(len(ans))
for i in range(0, len(ans)):
    print(ans[i][0],ans[i][1],ans[i][2],ans[i][3],end="")
    print()
ab = inpout()
a, b = ab.split("")
A = int(a)
B = int(b)

if "0" in a or "0" in b:
	print(-1)
else
	print(A * B)

### FIXED CODE ###

ab = input()
a, b = ab.split(" ")
A = int(a)
B = int(b)

if "0" in a or "0" in b or A > 9 or B > 9:
    print(-1)
else:
    print(A * B)
# -*- coding: utf-8 -*-

def solve():
    N, K = map(int, input().split())
    A = list(map(int, input().split()))
    D = {}
    for j,a in enumerate(A):
        D[a] = D.get(a,[])+[j]

    t,k = 0,0
    T = [0]
    while True:
        k = (D[A[t]].index(t)+1)%len(D[A[t]])
        if k == 0:
            T.append(A[t])
        t = (D[A[t]][k]+1)%N
        if t == 0:
            break

    T[0] = T.pop()
    t = D[T[K%len(T)]][0]+1
    S = []
    while t < N:
        k = (D[A[t]].index(t)+1)%len(D[A[t]])
        if k == 0:
            S.append(A[t])
        t = D[A[t]][k]+1

    res = ' '.join(map(str,S))

    return str(res)

if __name__ == '__main__':
    print(solve())

### FIXED CODE ###

# -*- coding: utf-8 -*-

def solve():
    N, K = map(int, input().split())
    A = list(map(int, input().split()))
    D = {}
    for j,a in enumerate(A):
        D[a] = D.get(a,[])+[j]

    t,k = 0,0
    T = [0]
    while True:
        k = (D[A[t]].index(t)+1)%len(D[A[t]])
        if k == 0:
            T.append(A[t])
        t = (D[A[t]][k]+1)%N
        if t == 0:
            break

    if T == [0]:
        return ''
    if K == 1 or (K-1)%len(T) == 0:
        t = 0
    else:
        t = D[T[(K-1)%len(T)]][0]+1
    S = []
    flag = False
    while t < N:
        k = (D[A[t]].index(t)+1)%len(D[A[t]])
        if k == 0:
            S.append(A[t])
            t += 1
        else:
            t = D[A[t]][k]+1

    res = ' '.join(map(str,S))

    return str(res)

if __name__ == '__main__':
    print(solve())
import sys
input = sys.stdin.readline
INF = 10**11
A,B,Q = map(int,input().split())
s = [-INF] + [int(input()) for _ in range(A)] + [INF]
t = [-INF] + [int(input()) for _ in range(B)] + [INF]
def binary_search(lis,x):
    ok = 0
    ng = len(lis)-1
    while ng-ok > 1:
        mid = (ok+ng)//2
        if lis[mid] < x:
            ok = mid
        else:
            ng = mid
    return ok
#print(s,t)
for _ in range(Q):
    x = int(input())
    ps = binary_search(s,x)
    pt = binary_search(t,x)
    ans = INF
    #print(ps,pt)
    for i in range(ps,ps+2):
        for j in range(pt,pt+2):
            ans = min(ans,abs(s[i]-X)+abs(s[i]-t[j]), abs(t[j]-X)+abs(t[j]-s[i]))
    print(ans)  
            


### FIXED CODE ###

import sys
input = sys.stdin.readline
INF = 10**11
A,B,Q = map(int,input().split())
s = [-INF] + [int(input()) for _ in range(A)] + [INF]
s.sort()
t = [-INF] + [int(input()) for _ in range(B)] + [INF]
t.sort()
def binary_search(lis,x):
    ok = 0
    ng = len(lis)-1
    while ng-ok > 1:
        mid = (ok+ng)//2
        if lis[mid] < x:
            ok = mid
        else:
            ng = mid
    return ok
#print(s,t)
for _ in range(Q):
    x = int(input())
    ps = binary_search(s,x)
    pt = binary_search(t,x)
    ans = INF
    #print(ps,pt)
    for i in range(ps,ps+2):
        for j in range(pt,pt+2):
            ds = x - s[i]
            dt = x - t[j]
            
            if (ds < 0 and dt < 0) or (ds > 0 and dt > 0):
                ans = min(ans,max(abs(ds),abs(dt)))
            else:
                ans = min(ans,abs(ds)+abs(dt)+min(abs(ds),abs(dt)))
    print(ans)
N, M = map(int, input().split())
G = {k: [] for k in range(N+1)}
for _ in range(N):
    a, b = map(int, input().split())
    # 無向グラフ
    G[a-1].append(b-1)
    G[b-1].append(a-1)

visited = [False]*N
visited[0] = True


def dfs(v):
    if all(visited):
        ans += 1
        return
    for nv in G[i]:
        if visited[nv] is False:
            visited[nv] = True
            dfs(nv)
            visited[nv] = False
    return


ans = 0
dfs(0)
print(ans)


### FIXED CODE ###

import itertools

N,M=map(int,input().split())
route=[list(map(int,input().split())) for _ in range(M)]
candidate=list(itertools.permutations(range(1,N+1)))

ans=0
for c in candidate:
  if c[0]==1:
    for i in range(N-1):
      l=sorted([c[i], c[i+1]])
      if l not in route:
         break
    else:
      ans+=1
print(ans)
m = int(input())
a = []
sosu = []
import math
def sosuuhantei(x):
    p = x
    if p < 2:
        return False
    elif  n == 2:
        return p
    else:
        for i in range(3,math.floor(math.sqrt(x)) + 1,2):
            if x % i == 0:
                return False
        else:
             sosu.append(x)
            
    


for i in range(55556):
    sosuuhantei(i)


import random
s = random.sample(sosu,m)

strs = ''
for i in range(m):
    strs = strs + str(s[i]) + ' '
print(strs)

### FIXED CODE ###

import math
import random
m = int(input())
n = 10000
def sosuuhantei(x):
    p = x
    if p < 2:
        return false
    elif  n == 2:
        return p
    else:
        for i in range(3,math.floor(math.sqrt(x)) + 1,2):
            if x % i == 0:
                return False
        else:
             return x
sosulist = []
 
if n < 2:
    None
elif n == 2:
    sosulist.append(2)
else:
    sosulist.append(2)
    for i in range(3,n+1,2):
        sosulist.append(sosuuhantei(i))
        
while False in sosulist:
    sosulist.remove(False)

s = []
for i in range(len(sosulist)):
    if sosulist[i] % 5 == 1:
        s.append(sosulist[i])

strs = ''
for i in range(m):
    strs = strs + str(s[i]) + ' '
print(strs)
n=int(input())
d=[int(x) for x in input().split()]

d.sort()
dd=[0]*10**5
for i in d:
    d[i]+=1

ans=True
now=1
if(dd[0]!=1):
    ans=False
else:
    before=1

for i in dd[1:]:
    if(i==0):
        ans=False
    now=now*(before**i) % 998244353

if(ans):
    print(now)
else:
    print("0")

### FIXED CODE ###

n=int(input())
d=[int(x) for x in input().split()]
ans=True
if(d[0]!=0):
    ans=False
d.sort()
dd=[0]*10**5
max=0
for i in d:
    dd[i]+=1
    if(max<i):
        max=i

now=1
before=0
if(dd[0]!=1):
    ans=False
else:
    before=1

for i in range(1,max+1):
    if(dd[i]==0):
        ans=False
    now=now*(before**dd[i]) % 998244353
    before=dd[i]
    #print(dd[i],now)

if(ans):
    print(now)
else:
    print("0")
o=list(input())
e=list(input())
n=max(len(o),len(e))
for i in range(n):
  print(o[i],end="")
  print(e[i],end="")

### FIXED CODE ###

o=list(input())
e=list(input())+[""]
for x,y in zip(o,e):print(x+y,end="")
K,A,B = (int(x) for x in input().split())
ans = 1

if B-A>2:
    if K>= A-1:
        ans += A - 1
        K -= A - 1
        if K >= 2:
            ans = ans + (B - A) * ((unsigned long long)(K / 2));
            K = K % 2;

ans += K

print(ans)



### FIXED CODE ###

K,A,B = (int(x) for x in input().split())
ans = 1

if B-A>2:
    if K>= A-1:
        ans += A - 1
        K -= A - 1
        if K >= 2:
            ans = ans + (B - A) * (K // 2)
            K = K % 2

ans += K

print(ans)
i=1
while True:
    x=int(input())          
    print("Case %d: %d",i,x)



### FIXED CODE ###

i=0
while True:
    x=int(input()) 
    if(x==0):
        break 
    i=i+1
    print(f"Case {i}: {x}")
import fraction
from functools import reduce

N = int(input())
As = map(int, input().split())

print(reduce(fraction.gcd, As))


### FIXED CODE ###

import fractions
from functools import reduce

N = int(input())
As = map(int, input().split())

print(reduce(fractions.gcd, As))
n = int(input())
numberL = list(map(int, input().split()))
 
kisuuSyuL=[]
kisuuKosuL=[]
kisuuKosuL2=[]
gusuSyuL=[]
gusuKosuL=[]
gusuKosuL2=[]
 
index=0
while index<n:
    if index==0:
        gusuSyuL.append(numberL[index])
        gusuKosuL.append(1)
        gusuKosuL2.append(1)
    elif index==1:
        kisuuSyuL.append(numberL[index])
        kisuuKosuL.append(1)
        kisuuKosuL2.append(1)
    else:
        if index%2==0:
            if numberL[index] in gusuSyuL:
                tarI = gusuSyuL.index(numberL[index])
                gusuKosuL[tarI]+=1
                gusuKosuL2[tarI]+=1
            else:
                gusuSyuL.append(numberL[index])
                gusuKosuL.append(1)
                gusuKosuL2.append(1)
        else:
            if numberL[index] in kisuuSyuL:
                tarI = kisuuSyuL.index(numberL[index])
                kisuuKosuL[tarI]+=1
                kisuuKosuL2[tarI]+=1
            else:
                kisuuSyuL.append(numberL[index])
                kisuuKosuL.append(1)
                kisuuKosuL2.append(1)
    index+=1

 
if len(kisuuSyuL)==1 and len(gusuSyuL)==1:
    if kisuuSyuL[0]==gusuSyuL[0]:
        print(int(n/2))
    else:
        print(0)
else:
    kiIndex = kisuuKosuL.index(max(kisuuKosuL))
    guIndex = gusuKosuL.index(max(gusuKosuL))
    if kisuuSyuL[kiIndex]!=gusuSyuL[guIndex]:
        noC=max(kisuuKosuL)+max(gusuKosuL)
        print(n-noC)
    else:
        if max(kisuuKosuL) < max(gusuKosuL):
            kisuuKosuL.sort()
            noC=kisuuKosuL[len(kisuuKosuL)-1]+max(gusuKosuL)
            print(n-noC)
        else:
            gusuKosuL.sort()
            noC=gusuKosuL[len(gusuKosuL)-1]+max(kisuuKosuL)
            print(n-noC)

### FIXED CODE ###

listN = list(str(input()))

index=0
while index < 3:
    if listN[index] == "1":
        listN[index]="9"
    elif listN[index]=="9":
        listN[index]="1"
    index+=1

print(listN[0]+listN[1]+listN[2])
# C
import functools
def gcd(a,b):
    if a<b:a,b=b,a
    if a%b==0:return b
    return gcd(b,a%b)

n = int(input())
a = list(map(int, input().split()))
ans = 0

for i in range(n):
    values = a[:i] + a[i+1:]
    gcd = functools.reduce(gcd, values)
    ans = max(ans, gcd)
print(ans)

### FIXED CODE ###

# C
import functools
# 3.4以前は math の gcd が対応していないので fractions のものを使う
# from fractions import gcd
def gcd(a,b):
    if a<b:a,b=b,a
    if a%b==0:return b
    return gcd(b,a%b)


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

gcd_left = [a[0]]
gcd_right = [a[-1]]
for i in range(1,n):
    if gcd_left[i-1] != 1:
        res = gcd(gcd_left[i-1], a[i])
    else:
        res = 1
    gcd_left.append(res)

for i in range(1,n):
    if gcd_right[i-1] != 1:
        res = gcd(gcd_right[i-1], a[-(i+1)])
    else:
        res = 1
    gcd_right.append(res)
gcd_right = gcd_right[::-1]


ans = 0
for i in range(n):
    if i == 0:
        res = gcd_right[1]
    elif i == n-1:
        res = gcd_left[-2]
    else:
        res = gcd(gcd_right[i+1], gcd_left[i-1])
    ans = max(res, ans)
print(ans)
import math
def lcm(x, y):
    return (x * y) // math.gcd(x, y)

A,B,C,D=map(int ,input().split())
a = B//C-(A-1)//C
b = B//D-(A-1)//D
c  =lcm(C,D)
d = B//c-(A-1)//c
e = B - A +1 - a -b + d 
print(e)

### FIXED CODE ###

def gcd(a, b):
    while b:
        a, b = b, a % b
    return a

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

A,B,C,D=map(int ,input().split())
a = B//C-(A-1)//C
b = B//D-(A-1)//D
c  =lcm(C,D)
d = B//c-(A-1)//c
e = B - A +1 - a -b + d 
print(e)
N = int(input())
K = int(input())
X = int(input())
Y = int(input())

# N泊連続で行う。最初の K 泊まで X 円.　K+1泊以降はY円

if  N <= K:
    print(X*N)
else:
    print(((N-K)*Y) + (X*Y)

### FIXED CODE ###

N = int(input())
K = int(input())
X = int(input())
Y = int(input())
if N <= K :
    ans = X * N
else :
    ans = X * K + Y * (N - K)
print(ans)
a = 1
b = 2
c = 3
d = 4
e = 5
a,b,c,d,e = map(int,input().split())
if a != 1
print(1)

if b != 2
print(2)

if c != 3
print(3)

if d != 4
print(4)

if e != 5
print(5)

### FIXED CODE ###

a = 1
b = 2
c = 3
d = 4
e = 5
a,b,c,d,e = map(int,input().split())

if a != 1:
    print("1")

if b != 2:
    print("2")

if c != 3:
    print("3")

if d != 4:
    print("4")

if e != 5:
    print("5")