Harryxun/stf_run huggingface dataset:
import sys
input = sys.stdin.readline
s = list(input())
t = list(input())
s = sorted(s)
t = sorted(t, reverse=True)
alpha2num = lambda c: ord(c) - ord("a")
if s == t:
    print("No")
    sys.exit()
for i in range(min(len(s), len(t))):
    if alpha2num(i) < alpha2num(j):
        print("Yes")
        sys.exit()
    elif alpha2num(i) > alpha2num(j):
        print("No")
        sys.exit()
if len(t) > len(s):
    print("Yes")

### FIXED CODE ###

import sys
input = sys.stdin.readline
s = list(input().rstrip())
t = list(input().rstrip())
s = sorted(s)
t = sorted(t, reverse=True)
alpha2num = lambda c: ord(c) - ord("a")
if s == t:
    print("No")
    sys.exit()
for i in range(min(len(s), len(t))):
    x, y = s[i], t[i]
    if alpha2num(x) < alpha2num(y):
        print("Yes")
        sys.exit()
    elif alpha2num(x) > alpha2num(y):
        print("No")
        sys.exit()
if len(t) > len(s):
    print("Yes")
else:
    print("No")
n = int(input())
s = input()
cnt = 0
for i in range(10):
    a = s.find(i)
    if a == -1:
        continue
    for j in range(10):
        b = s.find(j,a+1)
        if b == -1:
            continue        
        for k in range(10):
            if str(k) in s[b+1::]:
                cnt += 1
print(cnt

### FIXED CODE ###

n = int(input())
S = input()
count = 0
for i in range(10):
    a = S.find(str(i))
    if a == -1:
        continue
    for j in range(10):
        b = S.find(str(j),a + 1)
        if b == -1:
            continue
        for k in range(10):
            if str(k) in S[b+1::]:
                count += 1
print(count)
def burger_size(N):
    if N == 0:
        return 1
    return 3 + 2 * burger_size(N - 1)

def burger_patty_num(N):
    if N == 0:
        return 1
    return 1+ 2 * burger_patty_num(N - 1)

def patty_num(N, X):
    if X == 0:
        return 0
    if X <= 1 + burger_size(N - 1):
        return patty_num(N - 1, X - 1)
    elif X == 2 + burger_size(N - 1):
        return 1 + burger_patty_num(N - 1)
    elif X <= 2 + 2 * burger_size(N - 1):
        return 1 + burger_patty_num(N - 1) + patty_num(N - 1, X - (2 + burger_size(N - 1)))
    else:
        return 1 + 2 * burger_patty_num(N - 1)
        
    
N, X = map(int, input().split())
print(patty_num(N, X))

### FIXED CODE ###

def patty_num(N):
    if N == 0:
        return 1
    return 1 + 2 * patty_num(N - 1)

def burger_height(N):
    if N == 0:
        return 1
    else:
        return 3 + 2 * burger_height(N - 1)
    
def f(N, X):
    if X == 1:
        if N == 0:
            return 1
        else:
            return 0
    elif 1 < X and X <= burger_height(N - 1) + 1:
        return f(N - 1, X - 1)
    elif X == burger_height(N - 1) + 2:
        return patty_num(N - 1) + 1
    elif burger_height(N - 1) + 2 < X and X <= 2 * burger_height(N - 1) + 2:
        return patty_num(N - 1) + 1 + f(N - 1, X - 2 - burger_height(N - 1))
    
    return 2 * patty_num(N - 1) + 1
    
N, X = map(int, input().split())
print(f(N, X))
# Product
# シカのAtCoDeerくんは二つの正整数a,bを見つけました。aとbの席が偶数か奇数か判定してください。
# 1<a,b<10000
# a.bは整数

a = int(input())
b = int(input())

# print(a,b,x)

# 積が奇数なら"Odd"、偶数なら"Even"と
if (a * b) % 2 == 0:
    print("Even")
else:
    print("Odd")


### FIXED CODE ###

# Product
# シカのAtCoDeerくんは二つの正整数a,bを見つけました。aとbの席が偶数か奇数か判定してください。
# 1<a,b<10000
# a.bは整数

a,b = map(int, input().split())
x = int(a * b)
# print(a,b,x)

# 積が奇数なら"Odd"、偶数なら"Even"と表示
if x % 2 == 0:
    print("Even")
else:
    print("Odd")
s = raw_input()
print(s[:4] + ' ' +s[4:])

### FIXED CODE ###

s = raw_input()
s2 = s[:4] + " " + s[4:]
print(s2)
N = int(input())
HP = [list(map(int,input().split())) for _ in range(N)]
HP.sort(key=lambda x: x[0]+x[1])
ceil = max(HP,key=lambda x: x[0])[0]
#dp[i][j] -> i人目まで見る。j人積むときの、座布団の枚数の最小値
dp = [ceil+1]*(N+1)
ans = 0
for i in range(N+1):
    dp[i][0] = 0
for i in range(N):
    h,p = HP[i]
    for j in range(N,0,-1):
        if dp[j-1]<=h:
            dp[j] = min(dp[j],dp[j-1]+p)
            ans = max(ans,j)

print(ans)

### FIXED CODE ###

N = int(input())
men = []
for _ in range(N):
    H,P = map(int,input().split())
    men.append((H,P,H+P))
men.sort(key=lambda x: x[2])

maxH = max(men)[0]
inf = maxH+1
#dp[i][j] -> i人目までみたとき、j人が座布団を積む場合の最小枚数
dp = [[-1]*(N+1) for _ in range(N+1)]
dp[0][0] = 0
for i in range(1,N+1):
    h,p,a = men[i-1]
    for j in range(1,N+1):
        if 0 <= dp[i-1][j-1] <= h:
            if dp[i-1][j] == -1:
                dp[i][j] = dp[i-1][j-1]+p
            else:
                dp[i][j] = min(dp[i-1][j],dp[i-1][j-1]+p)
        else:
            dp[i][j] = dp[i-1][j]

for j in range(N,-1,-1):
    if dp[-1][j] != -1:
        print(j)
        break
n,k= map(int, input().split())
a= list(map(int, input().split()))
a.sort()

if k==0:
    print(a[-1])
    exit()


# めぐる式二部探索
l=-1
r=pow(10,11)
while r-l>1:
    # rは常にOK、lは常にNG。
    mid=l+(r-l)//2
    cnt=k
    flag=True
    for i in range(n):
        if a[i]>mid:
            cnt-=a[i]//mid
            if cnt<0:
                flag=False
                break
    # なんらかの判定
    if flag:
        r = mid  # 判定がOKのとき→範囲を左に狭める
    else:
        l = mid  # 判定がNGのとき→範囲を右に狭める

print(r)


### FIXED CODE ###

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

if k==0:
    print(a[-1])
    exit()


# めぐる式二部探索
l=0
r=pow(10,11)
while r-l>1:
    # rは常にOK、lは常にNG。
    mid=l+(r-l)//2
    cnt=k
    flag=True
    for i in range(n):
        if a[i]>mid:
            x=-(-a[i]//mid)-1
            cnt-=x

    # なんらかの判定
    if cnt>=0:
        r = mid  # 判定がOKのとき→範囲を左に狭める
    else:
        l = mid  # 判定がNGのとき→範囲を右に狭める

print(r)
from sys import stdin
from functools import lru_cache


# 最小化問題
def chmin(a,b):
    if a > b: return b
    else: return a


def rec(i, dp):
    if dp[i] < float('inf'):
        return dp[i]
    elif i==0:
        return 0
    else:
        res = float('inf')
        if i>1:
            res = chmin(res,rec(i-1,dp)+abs(h_arr[i]-h_arr[i-1]))
        if i>2:
            res = chmin(res,rec(i-2,dp)+abs(h_arr[i]-h_arr[i-2]))
        dp[i] = res
        return res

@lru_cache(maxsize=1000)
def rec_(i):
    if i==0:
        return 0
    else:
        res = float('inf')
        if i>0:
            res = chmin(res,rec_(i-1)+abs(h_arr[i]-h_arr[i-1]))
        if i>1:
            res = chmin(res,rec_(i-2)+abs(h_arr[i]-h_arr[i-2]))
        return res


if __name__ == "__main__":
    _in = [_.rstrip() for _ in stdin.readlines()]
    N = int(_in[0])  # type:int
    h_arr = [0] * (N+2)
    h_arr[0:N] = list(map(int,_in[1].split(' ')))  # type:list(int)
    # vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
    # dp[i]:=カエルが足場iへと移動するのに必要な最小コスト
    dp = [float('inf')] * (N+2)  # 最小化問題
    dp[0] = 0                    # 初期条件
    
    # 貰うDP
    #for i in range(0,N):
    #    dp[i] = chmin(dp[i],dp[i-1]+abs(h_arr[i]-h_arr[i-1]))
    #    if i > 1:
    #        dp[i] = chmin(dp[i],dp[i-2]+abs(h_arr[i]-h_arr[i-2]))
    #cnt = dp[N-1]

    # 配るDP
    #for i in range(0,N):
    #    dp[i+1] = chmin(dp[i+1],dp[i]+abs(h_arr[i]-h_arr[i+1]))
    #    dp[i+2] = chmin(dp[i+2],dp[i]+abs(h_arr[i]-h_arr[i+2]))
    #cnt = dp[N-1]

    # メモ化再帰
    cnt = rec_(N-1)
    # ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    print(cnt)


### FIXED CODE ###

from sys import stdin


# 最小化問題
def chmin(a,b):
    if a > b: return b
    else: return a


if __name__ == "__main__":
    _in = [_.rstrip() for _ in stdin.readlines()]
    N = int(_in[0])  # type:int
    h_arr = list(map(int,_in[1].split(' ')))  # type:list(int)
    # vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
    dp = [float('inf')] * N  # 最小化問題
    dp[0] = 0                # 初期条件
    
    for i in range(0,N):
        dp[i] = chmin(dp[i],dp[i-1]+abs(h_arr[i]-h_arr[i-1]))
        if i > 1:
            dp[i] = chmin(dp[i],dp[i-2]+abs(h_arr[i]-h_arr[i-2]))
    cnt = dp[N-1]
    # ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    print(cnt)
x,y=map(int,input().split())  

if (y%==0) and (2*x<=y<=4*x) :
    print("Yes")
else :
    print("No")

### FIXED CODE ###

x,y=map(int,input().split())  
 
if (y%2==0) and (2*x<=y<=4*x) :
    print("Yes")
else :
    print("No")
N,K=map(int,input().split())
H=list[map(int,input().split())]
count=0
for h in H:
  if h>K:
  count+=1
print(count)

### FIXED CODE ###

N, K = map(int, input().split())
H = list(map(int, input().split()))
count = 0
for h in H:
    if h >= K:
        count = count+1
print(count)
N,K=map(int, input().split())
A=list(map(int, input().split())) 
A.sort(reverse=1)
m=A[0]
for i in range(N-1):
  if A[i]!=A[i+1]:
    m=min(m,A[i]-A[i+1])
amari=[0]*m
for j in range(m):
  for i in range(N):
    if A[i]%m==j:
      amari[j]=1
      break
n=K%m
if K>A[0]:
  print("IMPOSSIBLE")
elif amari[n]:
  print("POSSIBLE")
else:
  print("IMPOSSIBLE")

### FIXED CODE ###

import sys
N,K=map(int, input().split())
A=list(map(int, input().split())) 
A.sort(reverse=1)
m=A[0]
for i in range(N-1):
  if A[i]!=A[i+1]:
    m=min(m,A[i]-A[i+1])

n=K%m
if K>A[0]:
  print("IMPOSSIBLE")
  sys.exit()
for i in range(N):
  if A[i]%m==n:
    print("POSSIBLE")
    sys.exit()

print("IMPOSSIBLE")
def main():
    N  = int(input()) 
    A=list(map(int, input().split()))
    B = list(set(A))
    B.sort()
    Boo = [True]*len(B)
    _,s = sieve((2*10**5)+7)

    zero =  A.count(1)
    if A.count(1)>1:
        print(0)
        return
    if A.count(1)==1:
        print(1)
        return

    for i in range(len(B)):
        for j in range(i+1,len(B)):
            if Boo[j] and s[j] and B[j] % B[i] == 0:
                Boo[j] = False

    cnt = 0
    for i in range(len(B)):
        if Boo[i] and A.count(B[i])==1:
            cnt += 1

    print(cnt)


def sieve(n):
    is_prime = [True for _ in range(n+1)]
    is_prime[0] = False

    for i in range(2, n+1):
        if is_prime[i-1]:
            j = 2 * i
            while j <= n:
                is_prime[j-1] = False
                j += i
    table = [ i for i in range(1, n+1) if is_prime[i-1]]
    return is_prime, table


if __name__ == '__main__':
    main()

### FIXED CODE ###

import collections

def main():
    N  = int(input()) 
    A=list(map(int, input().split()))
    C = collections.Counter(A)
    B = list(set(A))
    B.sort()
    lenb = len(B)
    Boo = [True]*lenb
    ZENBU = [False]*(10**6+4)

    if C[1]>1:
        print(0)
        return
    if C[1]==1:
        print(1)
        return

    for i in range(lenb):
        temp = 2
        if ZENBU[B[i]]==False:
            while B[i]*temp < 1000002:
                ZENBU[B[i]*temp] = True
                temp+=1

    cnt = 0
    for i in range(lenb):
        if ZENBU[B[i]]==False and C[B[i]]==1:
            cnt += 1

    print(cnt)


if __name__ == '__main__':
    main()
import sys
sys.setrecursionlimit(999999)
dicte = {1:2, 2:5, 3:5, 4:4, 5:5, 6:6, 7:3, 8:7, 9:6}
n, m = map(int, input().split())
arr = list(map(int, input().split()))
dp = [-1 for i in range(n+1)]
def cast(a, b):
    return int(str(a)+str(b))
def solve(curn):
    maxi = -1
    if dp[curn] != -1:
        return dp[curn]

    for j in arr:
        if curn - dicte[j] >= 0:
            dp[curn-dicte[j]] = solve(curn-dicte[j])
            if dp[curn-dicte[j]] == None:
                maxi = max(j, maxi)
            else:
                maxi = max(cast(j, dp[curn-dicte[j]]), maxi)
    if maxi == -1:
        return None
    return maxi
print(solve(n))

### FIXED CODE ###

a, b = map(int, input().split())
if b % a == 0:
    print(a+b)
else:
    print(b-a)
n, k = map(int, input().split())
r, s, p = map(int, input().split())
t = input()

ans = 0
point_dict = {'r': p, 's': r, 'p': s }
for i in range(k):
    t_x = t[i::k]
    point_0 = 0
    point_1 = 0
    for j in range(len(t_x)):        
        if (j % 2) == 0:
            if (t_x[j] != t_x[j - 1 if j - 1 >= 0 else 1]) & (t_x[j] != t_x[j + 1 if j + 1 < len(t_x) else len(t_x) - 1]):
                point_0 += point_dict[t_x[j]]
            point_1 += point_dict[t_x[j]]
        else:
            if (t_x[j] != t_x[j - 1 if j - 1 >= 0 else 1]) & (t_x[j] != t_x[j + 1 if j + 1 < len(t_x) else len(t_x) - 1]):
                point_1 += point_dict[t_x[j]]
            point_0 += point_dict[t_x[j]]
    ans += max(point_0, point_1)
print(ans)

### FIXED CODE ###

n, k = map(int, input().split())
r, s, p = map(int, input().split())
t = input()
dp = [3] * k
point = 0
choice = (r, s, p)
t = t.replace('r', '2').replace('s', '0').replace('p', '1')
for j, i in enumerate(t):
    if dp[j % k] != int(i):
        point += choice[int(i)]
        dp[j % k] = int(i)
    else:
        dp[j % k] = 3
print(point)
x, n = map(int, input().split())
if n > 0:
    P = list(map(int, input().split()))
    Q = sorted(
        [[i, abs(i - x)] for i in range(1, 101) if i not in P],
        key=lambda x:x[0])
    Q.sort(key=lambda x:x[1])
    print(Q[0][0])
else:
    print(x)


### FIXED CODE ###

x, n = map(int, input().split())
if n > 0:
    P = list(map(int, input().split()))
else:
    P = []

ans, dist = 0, 1000
for i in range(-200, 200):
    if i not in P:
        if abs(i - x) < dist:
            dist = abs(i - x)
            ans = i
print(ans)
W, H, r, x ,y = list(map(int,input().split()))
print('Yes' if 0 <= x - r <= x + r = W and 0 <= y - r <= y + r = H else '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')
# -*- coding: utf-8 -*-
N = int(input())
a = []
for i in range(1,N+1):
  a.append(input())
  
if a.count("Y") == 0:
  print("Three")
else:
  print("Four")

### FIXED CODE ###

N = int(input())
S = list(map(str,input().split()))
if S.count("Y") == 0:
  print("Three")
else:
  print("Four")
s =map(str,(raw_input()))
flg = 0
for i in range(len(s)):
  if flg==0 and s[i]=='A':
    flg += 1
  elif flg!=0 and s[i]=='Z':
    flg+=1
    if s[i+1] == 'Z':
      flg+=1
    break
  elif flg!=0:
    flg+=1
print flg

### FIXED CODE ###

s =map(str,(raw_input()))
a = 0
z = 0
for i in range(len(s)):
  if s[i]=='A':
    a = i
    break
for i in range(len(s)):
  if s[-i-1]=='Z':
    z=len(s)-i-1
    break
print z-a+1
num = int(input())
lis = list(map(int,input().split()))
sum = 0
min = list[0]
max = list[0]
for i in range(num):
    if(min > list[i]):min = list[i]
    if(max < list[i]):max = list[i]
    sum = sum+list[i]
    
print("%d %d %d" %(min,max,sum))


### FIXED CODE ###

num = int(input())
lis = list(map(int,input().split()))
sum = 0
min = lis[0]
max = lis[0]
for i in range(num):
    if(min > lis[i]):min = lis[i]
    if(max < lis[i]):max = lis[i]
    sum = sum+lis[i]
    
print("%d %d %d" %(min,max,sum))
n,m,l = map(int, input().split())
a=[]
b=[]
ans=[[0 for _ in range(n)] for _ in range(l)]
for _ in range(n):
    a.append(list(map(int, input().split())))
for _ in range(m):
    b.append(list(map(int, input().split())))
for i in range(n):
    for j in range(l):
        for k in range(m):
            ans[i][j] = ans[i][j] + a[i][k] * b[k][j]
for ans_row in ans:
    print(*ans_row)



### FIXED CODE ###

n, m, l = map(int, input().split())
a = []
b = []
ans = [[0 for _ in range(l)] for _ in range(n)]
for _ in range(n):
    a.append(list(map(int, input().split())))
for _ in range(m):
    b.append(list(map(int, input().split())))
for i in range(n):
    for j in range(l):
        for k in range(m):
            ans[i][j] = ans[i][j] + a[i][k] * b[k][j]
for ans_row in ans:
    print(*ans_row)
N, M = map(int, input().split())
A = list(map(int, input().split()))
 
sum_A =0
for i in range(N):
    sum_A += A[i]

ans = 0
for i in range(N):
    if (4*M*A[i] < sum_A):
        ans+=1
    else:
    	ans+=0
    	
if (ans >= M):
    print('Yes')
else:
    print('No')


### FIXED CODE ###

X, Y, Z = map(int, input().split())

"""
temp = Y
Y = X
X = temp

temp = Z
Z = X
X = temp
"""

print(Z, X, Y)
a,b,c = map(int,input().split())
max_ = max([a,b,c])
ls = [a,b,c]
ls.pop(max_)

if ls[0]%2 == ls[1]%2:
    cnt = 2*max_- sum(ls) -2
    
else:
    cnt = 2*max_- sum(ls)
    
print(cnt)
    

### FIXED CODE ###

a,b,c = map(int,input().split())
max_ = max([a,b,c])
ls = [a,b,c]

if ls[0]%2 == ls[1]%2 == ls[2]%2:
    cnt = 3*max_- sum(ls)
    print(int(cnt/2))


else:
    ls.remove(max_)
    if ls[0]%2 == ls[1]%2:
        cnt = 2*max_- sum(ls) -2
        print(int(cnt/2 +1))    
    else:
        cnt = 2*max_- sum(ls) + 1
        print(int(cnt/2 +1))
A, B, K = map(int, input().split())

List = [x for x in range(max(A,B),1,-1) if A%x ==0 and B%x ==0]
print(List[K-1])

### FIXED CODE ###

A, B, K = map(int, input().split())

List = [x for x in range(min(A,B),0,-1) if A%x ==0 and B%x ==0]
print(List[K-1])
import math
def myAnswer(N:int, A:int, B:int) -> int:
   counter = math.ceil(N / (A + B))
   string = ("b"*A + "r"*B)*counter
   return list(string)[:N ].count("b")

def modelAnswer():
   tmp=1
def main():
   N,A,B = map(int,input().split())
   print(myAnswer(N,A,B))

if __name__ == '__main__':
   main()

### FIXED CODE ###

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

if(N <= (A+B)):
    if(N<=A):
        print(N)
    else:
        print(A)
else:
    ans = (N//(A+B)) * A
    amari=(N % (A+B))
    tmp=A
    if(amari <= tmp):
        ans+=amari
    else:
        ans+=tmp

    print(ans)
a,s = int(input())

if a >= 3200:
    print('s')

else:a < 3200
    print('red')

### FIXED CODE ###

a = int(input())
s = input()

if a >= 3200:
    print(s)

if a < 3200:
    print('red')
S = list(input())
K = int(input())
n = 0
for i in range(len(S)):
    if S[i] != "1":
        break
    else:
        n += 1

if K < n-1:
    print(S[1])
else:
    print(S[n])

### FIXED CODE ###

S = list(input())
K = int(input())
n = 0
for i in range(len(S)):
    if S[i] != "1":
        n = i +1
        break

if K < n:
    print(1)
else:
    print(int(S[n-1]))
A, B = map(int, raw_input().split())

if B%A == 0:
    print '{}'.format('A+B')
else: # B%A != 0
    print '{}'.format('B−A')


### FIXED CODE ###

A, B = map(int, raw_input().split())

if B%A == 0:
    print '{}'.format(A+B)
else: # B%A != 0
    print '{}'.format(B-A)
import sys
readline = sys.stdin.readline

N = int(readline())
A = [0] + list(map(int,readline().split()))

sumA = [0] * len(A)
for i in range(1,len(A)):
  sumA[i] = sumA[i - 1] + A[i]
  
# 真ん中の分割点を決める
import bisect
mid = bisect.bisect_left(sumA, sumA[-1]//2)
ans = 10 ** 18
for i in range(max(0, mid - 1),min(mid + 2,len(sumA))):
  front = sumA[:i]
  back = list(map(lambda x:x - front[-1], sumA[i:]))
  if len(front) < 2 or len(back) < 2:
    continue
  front_mid = bisect.bisect_left(front, front[-1] // 2)
  back_mid = bisect.bisect_left(back, back[-1] // 2)
  for j in range(max(0, front_mid - 1), min(front_mid + 2, len(front))):
    P = front[j]
    Q = front[-1] - front[j]
    for k in range(max(0,back_mid - 1), min(back_mid + 2, len(back))):
      R = back[k]
      S = back[-1] - back[k]
      diff = max(P,Q,R,S) - min(P,Q,R,S)
      if ans > diff:
        ans = diff
      
print(ans)

### FIXED CODE ###

import sys
readline = sys.stdin.readline

# 累積和によって、各区間の和をO(1)で求められるようにしておく
# B,C,D,Eに分けたときに、CとDの切れ目を固定する
# Cの終わりが決まったとき、Bを先頭から探索していくとB,Cを切るベストな点が分かる
# （BとCの絶対値の差が最小になる点）
# 同様に、CとDを切るベストな点が分かる
# これらのindexを覚えておくと、CとDの切れ目を移動したときにこの点から開始することが出来て
# O(N)の定数倍で解くことが出来る

N = int(readline())
A = [0] + list(map(int,readline().split()))
for i in range(1, len(A)):
  A[i] += A[i - 1]

#print(A)

b_end = 1
c_end = 2
d_end = 3
e_end = len(A) - 1
bc_best = 10 ** 10
de_best = 10 ** 10
ans = 10 ** 10
def get_ans(b_end,c_end,d_end):
  B = A[b_end]
  C = A[c_end] - A[b_end]
  D = A[d_end] - A[c_end]
  E = A[-1] - A[d_end]
#  print("get_ans b_end",b_end,"c_end",c_end,"d_end",d_end)
#  print("get_ans B",B,"C",C,"D",D,"E",E)
  return max(B,C,D,E) - min(B,C,D,E)

for c_end in range(2, N - 1):
  # b_endを右に進める条件は、今BよりCのほうが大きいこと 且つ c_endに追いつかないこと
  # Bのほうが大きくなったら、その直前と比べてどっちのほうが絶対値が小さいかを確認する
  B = A[b_end]
  C = A[c_end] - A[b_end]
  best_b_end = b_end
  if B != C:
    while b_end + 1 < c_end and B < C:
      b_end += 1
      tempB = B
      tempC = C
      B = A[b_end]
      C = A[c_end] - A[b_end]
      if B == C:
        best_b_end = b_end
        break
      if B > C:
        # ここでBのほうが大きくなったら有利なほうを採用する
        if abs(tempB - tempC) > abs(B - C):
          best_b_end = b_end
        break
      else:
        best_b_end = b_end
  b_end = best_b_end
  
  D = A[d_end] - A[c_end]
  E = A[e_end] - A[d_end]
  best_d_end = d_end
  if D != E:
    while d_end + 1 < e_end and D < E:
      d_end += 1
      tempD = D
      tempE = E
      D = A[d_end] - A[c_end]
      E = A[e_end] - A[d_end]
      if D == E:
        best_d_end = d_end
        break
      if D > E:
        if abs(tempD - tempE) > abs(D - E):
          best_d_end = d_end
        break
      else:
        best_d_end = d_end
  d_end = best_d_end
    
  val = get_ans(b_end,c_end,d_end)
  if val < ans:
    ans = val
    
print(ans)
N = input()
B = False
kaisu = 0
array = map(int,input().split())
while !B:
	for i in range(N):
  		if array[i]/2 == 1:
    	B = True
  	if B == False:
    	array = map(calc ,array)
    	kaisu++
  	else:
    	break
        
print(kaisu)

def calc(n):
  retuen n/2
    

    

### FIXED CODE ###

N = int(input())
B = False
kaisu = 0
array = list(map(int,input().split()))

def calc(n):
  return int(n) / 2
  
  
while not B:
  for i in range(N):
    if array[i] % 2 == 1:
      B = True
  if not B:
    array = list(map(calc, array))
    kaisu += 1
  else:
    break
        
print(kaisu)
N,A,B,C,D=map(int,input().split())
S=list(input())
a=0
E=N-D
if C>D:
    for i in range(N-3):
        if S[i]=="#":
            for j in range(1,4):
                if S[i]==S[i+j]:
                    a=1
    if E==0:
        for i in range(B-1,D-1):
        if S[i]==".":
            if S[i]==S[i+1] and S[i+1]==S[i+2]:
                a=0
                break
    if E>=1:
        for i in range(B-1,D):
        if S[i]==".":
            if S[i]==S[i+1] and S[i+1]==S[i+2]:
                a=0
                break
for i in range(N-1):
    if S[i]=="#":
        if S[i+1]=="#":
            a=1
if a==0:
    print("Yes")
if a==1:
    print("No")

### FIXED CODE ###

N,A,B,C,D=map(int,input().split())
S=list(input())
a=0
E=N-D
if C>D:
    for i in range(N-3):
        if S[i]=="#":
            for j in range(1,4):
                if S[i]==S[i+j]:
                    a=1
    if E==0:
        for i in range(B-2,D-2):
            if S[i]==".":
                if S[i]==S[i+1] and S[i+1]==S[i+2]:
                    a=0
                    break
    if E>=1:
        for i in range(B-2,D-1):
            if S[i]==".":
                if S[i]==S[i+1] and S[i+1]==S[i+2]:
                    a=0
                    break
for i in range(A,D):
    if S[i]=="#":
        if S[i+1]=="#":
            a=1
if a==0:
    print("Yes")
if a==1:
    print("No")
a,b=map(int,input())
s=[]
s.append(a+b,a-b,a*b)
print(max(s))

### FIXED CODE ###

a,b=map(int,input().split())
s=[a+b,a-b,a*b]
print(max(s))
s=input()
i=0
j=len(s)-1
ans=0
while i<j:
    while s[i]==s[j]=="x":
        i+=1
        j-=1
    while s[i]=="x":
        i+=1
        ans+=1
        if i==len(s):break
    if i>j:break
    while s[j]=="x":
        j-=1
        ans+=1
        if j==-1:break
    if s[i]!=s[j]:
        ans=-1
        break
    if i>j:break
    i+=1
    j-=1
    if i>j:break
print(ans)

### FIXED CODE ###

s=input()
i=0
j=len(s)-1
ans=0
while i<j:
    while s[i]==s[j]=="x":
        i+=1
        j-=1
        if i>j:break
    if i>j:break    
    while s[i]=="x":
        i+=1
        ans+=1
        if i>j:break
    if i>j:break
    while s[j]=="x":
        j-=1
        ans+=1
        if i>j:break
    if i>j:break
    if s[i]!=s[j]:
        ans=-1
        break
    i+=1
    j-=1
    if i>j:break
print(ans)
a = input()
b = []
sum = 0
for i in a:
  b[i] = input()
  sum += b[i]
print(reciprocal(reciprocal(sum)))


### FIXED CODE ###

N = int(input())
A = list(map(int, input().split()))
sam = 0
for i in range(N):
  sam += A[i]**-1
print(sam**-1)