Harryxun/stf_run huggingface dataset:
N = int(input())
a = list(map(int,input().split()))
b=[]
for i in range(N+1):
  b.append(1.0/a[i])
  B = sum(b)
print(1/B)

### FIXED CODE ###

N = int(input())
a = list(map(int,input().split()))
b=[]
for i in range(N):
  b.append(1.0/a[i])
  B = sum(b)
print(1.0/B)
from collections import Counter
n = int(input())
A = list(map(int,input().split()))
if 1 in A:
    print(0)
else:
    c = Counter(A)
    lst = []
    for k,v in c.items():
        if v==1:
            lst.append(k)
    lst.sort()
    mx = max(lst)
    ans = 0
    err = [False] + [True]*(mx)
    for l in lst:
        if err[l]:
            ans += 1
            i = 0
            while True:
                err[l*i] = False
                i += 1
                if l*i > mx:
                    break
    print(ans)

### FIXED CODE ###

from collections import Counter
n = int(input())
A = list(map(int,input().split()))
A.sort()
c = Counter(A)

if c[1]==1:
    print(1)
elif c[1] > 1:
    print(0)
else:
    mx = 10**6+10
    ok = [True]*mx
    ans = 0
    for a in A:
        if ok[a]:
            if c[a] == 1:
                ans += 1
            for i in range(mx):
                if i*a >= mx:
                    break
                ok[i*a] = False
        else:
            continue
    print(ans)
N,K=map(int,input().split())

Sanuke=list(range(K))

def calc_double(n):
	return n - 1
def calc_zero(n):
	return n *0

Sanuke=map(calc_Sanuke, Sanuke)
  
for i in range(N):
  di=int(input())
  A=list(map(int,input().split()))
  A=map(calc_double, A)
  for j in A:
    Sanuke[j]+=1

higaisha=0

for i in Sanuke:
  if i ==0:
    higaisha += 1

print(higaisha)

### FIXED CODE ###

n,k=map(int,input().split())

ans=[0]*n

for i in range(k):
  d=int(input())
  a=[int(k) - 1 for k in input().split()]
  for j in a:
    ans[j]+=1

ansint=0


for i in range(n):
  if ans[i]==0:
    ansint+=1


print(ansint)
r = int(input())
print(2 * pi * r)

### FIXED CODE ###

import math

r = int(input())
print(2 * math.pi * r)
import sys
import numpy as np
input = sys.stdin.readline
N = int(input())
B = [[int(x) for x in input().split()] for _ in range(N)]
def heighti(Cx,Cy,x,y,h):
    return abs(x-Cx) + abs(y-Cy) + h
ans = []
h0 = []
A = []
for l in B:
    if l[2] == 0:
        h0.append([l[0],l[1]])
    else:
        A.append(l)
for i in range(101):
    for j in range(101):
        tempH = heighti(i,j,A[0][0],A[0][1],A[0][2])
        if tempH < 0:
            break
        else:
            flag = 1
            for k in range(1,len(A)):
                if A[k][2] != 0 and heighti(i,j,A[k][0],A[k][1],A[k][2]) != tempH:
                    flag = 0
                    break
            if flag:
                ans.append([i,j,tempH])
if len(ans) == 1:
    print(*ans[0])
elif len(ans) == 0:
    for i in range(101):
        for j in range(101):
            for k in range(N):
                if heighti(i,j,A[k][0],A[k][1],A[k][2]) > 0:
                    print(*[i,j,heighti(i,j,A[k][0],A[k][1],A[k][2])])
                    sys.exit()
else:
    for m in ans:
        for n in h0:
            if heighti(n[0],n[1],m[0],m[1],m[2]) > 0:
                break
        print(*m)
        sys.exit()
        

### FIXED CODE ###

import sys
input = sys.stdin.readline
N = int(input())
B = [[int(x) for x in input().split()] for _ in range(N)]
def heighti(Cx,Cy,x,y,h):
    return abs(x-Cx) + abs(y-Cy) + h
def Heighti(Cx,Cy,x,y,h):
    return -abs(x-Cx) - abs(y-Cy) + h
ans = []
h0 = []
A = []
for l in B:
    if l[2] == 0:
        h0.append([l[0],l[1]])
    else:
        A.append(l)
if len(A) > 0:
    for i in range(101):
        for j in range(101):
            tempH = heighti(i,j,A[0][0],A[0][1],A[0][2])
            if tempH < 0:
                break
            else:
                flag = 1
                for k in range(1,len(A)):
                    if A[k][2] != 0 and heighti(i,j,A[k][0],A[k][1],A[k][2]) != tempH:
                        flag = 0
                        break
                if flag:
                    ans.append([i,j,tempH])
if len(ans) == 1:
    print(*ans[0])
elif len(ans) == 0:
    for i in range(101):
        for j in range(101):
            for k in range(N):
                if heighti(i,j,B[k][0],B[k][1],B[k][2]) > 0:
                    print(*[i,j,heighti(i,j,B[k][0],B[k][1],B[k][2])])
                    sys.exit()
else:
    for m in ans:
        flag = 1
        for n in h0:
            if Heighti(n[0],n[1],m[0],m[1],m[2]) > 0:
                flag = 0
                break
        if flag:
            print(*m)
            sys.exit()
import sys
import math

sys.setrecursionlimit(10 ** 7)
INF = 10 ** 9 + 7

def P(n, r):
    return math.factorial(n) // math.factorial(n - r)



n, k = list(map(int, sys.stdin.readline().split()))
graph = [dict() for i in range(n)]
for i in range(n):
    graph[i]["eda"]=[]
for i in range(n - 1):
    a, b = list(map(int, sys.stdin.readline().split()))
    graph[a - 1]["eda"].append(b - 1)
    graph[b - 1]["eda"].append(a - 1)
ans = 1
check = [False] * n
stack = [0]
ans = 1
while len(stack) > 0:
    x = stack.pop()
    check[x] = True
    count = 0
    for i in graph[x]["eda"]:
        if not check[i]:
            count += 1
            stack.append(i)
    if x == 0:
        temp = P(k - 1, count)
        ans = (ans * temp) % INF
    else:
        temp = P(k - 2, count)
        ans = (ans * temp) % INF

print((ans * k) % INF)

### FIXED CODE ###

import sys
sys.setrecursionlimit(10**7)
INF=10**9+7
def LI(): return list(map(int, sys.stdin.readline().split()))
 
def main():
    n, k = LI()
    graph=[[] for i in range(n)]
    for i in range(n-1):
        a,b=LI()
        graph[a-1].append(b-1)
        graph[b-1].append(a-1)
    ans=1
    check=[False]*n
    stack=[0]
    ans=1
    while len(stack)>0:
        x=stack.pop()
        check[x]=True
        count=0
        for i in graph[x]:
            if not check[i]:
                count+=1
                stack.append(i)
        if x==0:
            temp=1
            for i in range(count):
                temp=temp*(k-1-i)%INF
            ans=ans*temp%INF
        else:
            temp=1
            for i in range(count):
                temp=temp*(k-2-i)%INF
            ans=ans*temp%INF
    print((ans*k)%INF)
 
 
if __name__ == "__main__":
    main()
n = int(input())
l=[1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
print(l[n])

### FIXED CODE ###

n =int(input())
l=[1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
print(l[n-1])
def f(h):
  if h==1:
    return 1
  else:
    return f[h//2]*2+1
  
print(f(int(input())))

### FIXED CODE ###

def f(h):
  if h==1:
    return 1
  else:
    return f(h//2)*2+1
  
print(f(int(input())))
import numpy as np
n,k = map(int,input().split())
s = list(input())
memory = s[0]
count = 1
lst = np.array([0])
M = 0
for i in range(1,n):
    if s[i] == memory:
        count += 1
    else:
        lst = np.append(lst,count)
        memory = s[i]
        count = 1
lst = np.append(lst,count)
cs = lst.cumsum()
if s[0] == '1':
    if (2*k+3) >= len(cs):
        print(cs[-1])
        exit()
    else:
        i = 0
        while i+2*k+2 <= len(cs):           
            M = max(M,cs[i+2*k+1]-cs[i])
            i += 2
        print(M)
        exit()
if s[0] == '0':
    if (2*k+2) >= len(cs):
        print(cs[-1])
        exit()
    else:
        i = 1
        while i+2*k+2 <= len(cs):
            M = max(M,cs[i+2*k+1]-cs[i])
            i += 2
        M = max(M,cs[2*k]-cs[0])
        print(M)
        exit()


### FIXED CODE ###

n,k = map(int,input().split())
s = input()
x = len(s)
lst = [0]
ans = 0
if s[0] == "1" and s[x-1] == "0":
    s = s[::-1]
for i in range(1,x):
    if s[i-1] != s[i]:
        lst.append(i)
lst.append(x)
if s[0] == "0" and s[x-1] == "1":
    if 2*k >= len(lst):
        ans = x
    else:
        i = 1
        while i+2*k+1 <= len(lst)-1:
            ans = max(ans,lst[i+2*k+1]-lst[i])
            i += 2
        ans = max(ans,lst[2*k])
if s[0] == "0" and s[x-1] == "0":
    if 2*k >= len(lst):
        ans = x
    else:
        i = 1
        while i+2*k+1 <= len(lst)-1:
            ans = max(ans,lst[i+2*k+1]-lst[i])
            i += 2
        ans = max(ans,lst[2*k])
        ans = max(ans,x-lst[len(lst)-2*k-1])
if s[0] == "1" and s[x-1] == "1":
    if 2*k+1 >= len(lst):
        ans = x
    else:
        i = 0
        while i+2*k+1 <= len(lst)-1:
            ans = max(ans,lst[i+2*k+1]-lst[i])
            i += 2
print(ans)
a,b,c,d=map(int,input().split())
if a+b > c+d:
print("Left")
elif a+b == c+d:
print("Balanced")
else:
print("Right")


### FIXED CODE ###

a,b,c,d=map(int,input().split())
if a+b > c+d:
    print("Left")
elif a+b == c+d:
    print("Balanced")
else:
    print("Right")
s = str(input())
print(len(s))
for i in range(len(s)):
    if s[i] == 'A':
        min = i
        break
for i in reversed(range(len(s))):
    if s[i] =='Z':
        max = i
        break

print(max)print(max-min+1)

### FIXED CODE ###

s = str(input())
for i in range(len(s)):
    if s[i] == 'A':
        min = i
        break
for i in reversed(range(len(s))):
    if s[i] =='Z':
        max = i
        break

print(max-min+1)
A,B,C=int(input().split())
if A<=C and B>=C:
  print('YES')
else:
  print('NO')


### FIXED CODE ###

A,B,C=map(int,input().split())
if A<=C and C<=B:
  print('Yes')
else:
  print('No')
N,M = map(int,input().split())

a = [0]*M
b = [0]*M
c = [0]*M

for i in range(M):
    a[i],b[i],c[i] = map(int,input().split())

d = [[0]*N for i in range(N)]

for i in range(M):
    d[a[i]-1][b[i]-1] = c[i]
    d[b[i]-1][a[i]-1] = c[i]
    



for i in range(N):
    for j in range(N):
        for s in range(N):
            d[i][j] = min(d[i][j], d[i][s]+d[s][j])

count = 0
for i in range(M):
    d[i][i] = float("inf")
    if d[a[i]-1][b[i]-1] != c[i]:

        count += 1
print(count)

### FIXED CODE ###

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

a = [0]*M
b = [0]*M
c = [0]*M

for i in range(M):
    a[i],b[i],c[i] = map(int,input().split())
    a[i] -= 1
    b[i] -= 1
    

d = [[float("inf")]*N for i in range(N)]

for i in range(M):
    d[a[i]][b[i]] = c[i]
    d[b[i]][a[i]] = c[i]
    
for i in range(N):
    d[i][i] = 0

for s in range(N):
    for j in range(N):
        for i in range(N):
            d[i][j] = min(d[i][j], d[i][s]+d[s][j])

count = 0
for i in range(M):
    if d[a[i]][b[i]] < c[i]:
        count += 1
print(count)
n,d=map(int,input().split())
lists=[list(map(int,input().split())) for x in range(n)]
answer=0
for i in range(1,n):
  for j in range(i+1,n+1):
    count=o
    for y in range(d):
      count+=(lists[j-1][y]-lists[i-1][y])**2
    t=count**(1/2)
    if t.is_integer():
        answer+=1
print(answer)

### FIXED CODE ###

n,d=map(int,input().split())
l=[list(map(int,input().split())) for i in range(n)]
cnt=0
for i in range(n-1):
  for j in range(i+1,n):
    sum=0
    for dd in range(d):
      sum+=(l[i][dd]-l[j][dd])**2
    if sum**0.5==int(sum**0.5):
      cnt+=1
print(cnt)
n = int(input())
a = list(map(int, input().split()))
a = list(set(a))
a.sort()
ans = 0
if len(a) == 1:
    print(0)
else:
    for _ in range(n):
        m = a.pop()
        ind = True
        print(a)
        for i in a:
            if m % i == 0:
                ind = False
                break
        if ind:
            ans += 1
    print(ans)


### FIXED CODE ###

n = int(input())
a = list(map(int, input().split()))
m = max(a)
y = [0] * (m + 1)
for i in a:
    x = i
    while x <= m:
        y[x] += 1
        x += i
ans = 0
for j in a:
    if y[j] == 1:
        ans += 1

print(ans)
N = int(input())

a = list(range(1, N+1))

if N ==1:
    sc = 1
else:
    sc = int((N**2-N)/2)
print(sc)


### FIXED CODE ###

N = int(input())

a = list(range(1, N+1))

if N ==1:
    sc = 0
else:
    sc = int((N**2-N)/2)
print(sc)
N = int(input())
A = list(map(int, input().split()))
B = []

for i in range(N):
    B.append(A[i] - i - 1)

B = sorted(B)
M = B[int((N + 1)/2)]
ans = 0

for i in range(N):
    t = B[i] - M
    if t < 0:
        t = (-1) * t
    ans += t

print(ans)


### FIXED CODE ###

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

for i in range(N):
    B.append(A[i] - i - 1)

B = sorted(B)
M = B[int((N - 1)/2)]
ans = 0

for i in range(N):
    t = B[i] - M
    if t < 0:
        t = (-1) * t
    ans += t

print(ans)
try:
 total=s=i=0 
 while True:
  a,b = map(int,input().split(','))
  total += a*b
  s += b
  i += 1
except:
 print(total)
 print(round(s/i+0.5))

### FIXED CODE ###

while True:
 try:
   a,b,c=map(float,input().split(','))
   bmi=b/c**2
   if bmi>=25:
     print(int(a))
 except:
  break
print(max(list(map(input().split()))) * 2 - 1)

### FIXED CODE ###

x = list(map(int, input().split()))
print(max(x) * 2 - 1) if min(x) != max(x) else print(x[0] * 2)
import sys

def makec(c):
  alph = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm',
           'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z']
  if c[-1] == 'z':
    return makec(c[-1])
  else:
    pos = (alph.index(c[-1]) + 1) % 26
    c = c[:-1] + alph[pos]
    return c


def f(S, K, c):
  if K == 0:
    return c[:-1]
  
  if c in S:
    c = c + 'a'
    return f(S, K-1, c)
  else:
    c = makec(c)
    return f(S, K, c)

def main():
  input = sys.stdin.readline
  S = str(input().strip())
  K = int(input())
  ans = f(S, K, 'a')
  print(ans)


if __name__ == '__main__':
  main()

### FIXED CODE ###

import sys


def main():
  input = sys.stdin.readline
  S = str(input().strip())
  K = int(input())
  max = min(5, len(S))
  sub = []
  for i in range(len(S)):
    for j in range(1, max+1):
      if i+j > len(S):
        continue
      sub.append(S[i:i+j])
  sub = sorted(list(set(sub)))
  print(sub[K-1])


if __name__ == '__main__':
  main()
N = int(input())
l = []
for i in range(N):
	a,b,c = map(int,input().split(' '))
	l.append(a,b,c)
	l.sort()
	s.add(l)
	l = []
print(N - len(s))

### FIXED CODE ###

N = int(input())
l = []
s = set()
for i in range(N):
	a,b,c = map(int,input().split(' '))
	l.append(a)
	l.append(b)
	l.append(c)
	l.sort()
	d = str(l[0])
	e = str(l[1])
	f = str(l[2])
	g = d + e + f
	s.add(g)
	l = []
print(N - len(s))
def main():
    X, K, D = map(int, input().split())
    if abs(X) == D:
        if K % 2 == 0:
            print(abs(X))
        else:
            print(0)
        return
    for i in range(K):
        plus = abs(X + D)
        minus = abs(X - D)
        if plus < minus:
            X += D
        else:
            X -= D
        print(X)
    print(abs(X)) 
            
if __name__ == '__main__':
    main()


### FIXED CODE ###

def main():
    X, K, D = map(int, input().split())
    if abs(X) == D:
        if K % 2 == 0:
            print(abs(X))
        else:
            print(0)
        return

    diff = K * D - abs(X)
    if abs(diff) <= D:
        print(abs(diff))
        return
    elif diff < 0:
        print(abs(diff))
        return
    count_minus = abs(diff // (2 * D))
    if X > 0:
        dest = X - (K - count_minus) * D + count_minus * D
        dest2 = X - (K - count_minus - 1) * D + (count_minus + 1) * D
    else:
        dest = X + (K - count_minus) * D - count_minus * D
        dest2 = X + (K - count_minus - 1) * D - (count_minus + 1) * D

    print(abs(dest) if abs(dest) < abs(dest2) else abs(dest2))

if __name__ == '__main__':
    main()
# -*- coding: utf-8 -*-
"""
Created on Tue Jan 21 16:49:00 2020

@author: matsui
"""

   
def cost(h,N,K):
    dp=[0]*N
    for i in range(1,N):
        tmp=[]
        for j in range(i-1,max(0,i-K)):
            tmp.append(abs(h[i]-h[j])+dp[j])
        dp[i]=min(tmp)
    return dp[-1]

N,K=map(int,input().split())
h=[int(num) for num in input().split()]

print(cost(h,N,K))

### FIXED CODE ###

# -*- coding: utf-8 -*-
"""
Created on Tue Jan 21 16:49:00 2020

@author: matsui
"""



N,K=map(int,input().split())
h=[int(num) for num in input().split()]

dp=[0]*N
dp[1]=abs(h[0]-h[1])
   
def cost(h,N,K,dp):
    for i in range(2,N):
        dp[i]=min([abs(h[i]-h[j])+dp[j] for j in range(max(0, i-K), i)])
    return dp[-1]
    
print(cost(h,N,K,dp))
A, B, K = map(int, input().split())
AB = list(range(A, B+1))
ans = sorted(set(AB[:K]+AB[-K:]))
 
if len(ans) >= 1:
    for i in ans:
        print(i)

### FIXED CODE ###

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

if b-a+1 <= 2*k:
    for num in range(a, b+1):
        print(num)
else:
    for num in range(a, a+k):
        print(num)
    for num in range(b-k+1,b+1):
        print(num)
height,width,a,b = map(int,input().split())
table = [['0' for i in range(width)] for j in range(height)]
replacement = a*height
i = 0
j = 0
while replacement != 0:
    # print('replace:',i,j)
    table[i][j] = '1'
    replacement -= 1
    if replacement%a == 0:
        # print('shift')
        i += 1
        # print(i)
    j += 1
# print('made table:',table)
flag = []
for j in range(width):
    x = sum(int(table[i][j]) for i in range(height)) 
    flag += [b == min(x,height-x)]
if all(flag):
    for i in range(height):
        print(''.join(table[i]))
else:
    print('No')

### FIXED CODE ###

H,W,A,B = map(int,input().split())

for i in range(H):
    if i < B:
        print('1'*A+'0'*(W-A))
    else:
        print('0'*A+'1'*(W-A))

# height,width,a,b = map(int,input().split())
# if a != 0 and b != 0:
#     table = [['0' for i in range(width)] for j in range(height)]
#     replacement = a*height
#     i = 0
#     j = 0
#     while replacement != 0:
#         # print('replace:',i,j)
#         table[i][j] = '1'
#         replacement -= 1
#         if replacement%a == 0:
#             # print('shift')
#             i += 1
#             # print(i)
#         j =(j+1)%width
        
#     # print('made table:',table)
#     flag = []
#     for j in range(width):
#         x = sum(int(table[i][j]) for i in range(height)) 
#         flag += [b == min(x,height-x)]
#     if all(flag):
#         for i in range(height):
#             print(''.join(table[i]))
#     else:
#         print('No')
# else:
#     if a == 0:
#         for i in range(b):
#             print('1'*width)
#         for i in range(height-b):
#             print('0'*width)
#     else:
#         for i in range(height):
#             print('1'*a+'0'*(width-a))
s = list(input())
k = int(input())
n = len(s)
c = ord("z") + 1
i = 0
for i in range(n):
    tmp = c - ord(s[i])
    if k >= tmp:
        s[i] = "a"
        k -= tmp
else:
    s[n-1] = chr(ord(s[n-1])+k)
print("".join(s))


### FIXED CODE ###

s = list(input())
k = int(input())
n = len(s)
map = {(chr(ord("a") + i)): (26-i)%26 for i in range(26)}
for i in range(n):
    if k >= map[s[i]]:
        k -= map[s[i]]
        s[i] = "a"
if k > 0:
    s[n-1] = chr((ord(s[n-1])+k%26)%123)
print("".join(s))
N, K = map(int,input().split( ))
l = []
for i in range(N):
	a, b = map(int, input().split( ))
	l.append(b)
	print(l)
	if sum(l) > K-1:
		print(a)
		break


### FIXED CODE ###

from collections import defaultdict

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

a = []
b = []

for i in range(N):
	a_i, b_i = map(int, input().split( ))
	a.append(a_i)
	b.append(b_i)

d = defaultdict(int)

for i in range(N):
    if a[i] in d:
        d[a[i]] += b[i]
    else:
        d[a[i]] = b[i]

d_sorted = sorted(d.items())

l = 0

for i in range(N):
	a_i = d_sorted[i][0]
	b_i = d_sorted[i][1]
	l += b_i
	if l >= K:
		print(a_i)
		break
import math

N = int(input())
name = [input() for i in range(N)]
nameList = [0 for i in range(5)]

for n in name:
  if n[0] == 'M':
    nameList[0] += 1
  elif n[0] == 'A':
    nameList[1] += 1
  elif n[0] == 'R':
    nameList[2] += 1
  elif n[0] == 'C':
    nameList[3] += 1
  elif n[0] == 'H':
    nameList[4] += 1

ans = [i for i in nameList if i != 0]
n = len(ans)
r = 3
a = 0
if len(ans) > 0:
	a = math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

for i in ans:
  a *= i
print(a)


### FIXED CODE ###

N = int(input())
name = [input() for i in range(N)]
nameList = [0 for i in range(5)]

P = [0 ,0 ,0 ,0 ,0 ,0 ,1 ,1 ,1 ,2]
Q = [1 ,1 ,1 ,2 ,2 ,3 ,2 ,2 ,3 ,3]
R = [2 ,3 ,4 ,3 ,4 ,4 ,3 ,4 ,4 ,4]

for n in name:
  if n[0] == 'M':
    nameList[0] += 1
  elif n[0] == 'A':
    nameList[1] += 1
  elif n[0] == 'R':
    nameList[2] += 1
  elif n[0] == 'C':
    nameList[3] += 1
  elif n[0] == 'H':
    nameList[4] += 1

ans = 0
for i in range(10):
  ans += nameList[P[i]] * nameList[Q[i]] * nameList[R[i]]
    
print(ans)
A=int(input())
B=int(input())
C=int(input())
D=int(input())
if A*B>=C*D:
  print (A*B)
else:
  print (C*D)

### FIXED CODE ###

A ,B ,C, D = [int(x) for x in input().strip().split(' ')]
r1 ,r2  =A*B, C*D
if (r1 > r2):
    print(r1)
elif(r2 >r1):
    print(r2)
else:
    print(r1)
reina@v157-7-237-130:~/magic/kyogi/Atcoder/abc/b101_125/b106$ cat ./c1.py
#!/usr/bin/env python3
# -*- coding: UTF-8 -*-
p=5000000000000000
s=input()
n=int(input())

chk=1
ans=f=0
for i in s:
    chk=1
    if i=="1": 
        ans+=1
        continue
    for j in range(p-1):
        chk*=int(i)
        if ans+chk>=p:
            print(i)
            f=1
            break
    ans+=chk
    if f==1: break
if f==0: print(s[-1])
reina@v157-7-237-130:~/mag

### FIXED CODE ###

s=input()
k=int(input())
x=-1
y=""
for a,i in enumerate(s):
    if i!="1":
        x=a
        y=i
        break

if x!=-1 and x+1<=k: print(y)
else: print(1)
a, b c = [int(i) for i in input().split()]

total = 0 
for d in range(a, b + 1):
    if c % d == 0:
        total += 1
        
print(total)

### FIXED CODE ###

a, b, c = [int(i) for i in input().split()]

total = 0 
for d in range(a, b + 1):
    if c % d == 0:
        total += 1
        
print(total)
def comb(a, b):
    ans, x, y = 0, a, b
    for i in range(1, b):
        x *= a-i
        y *= b-i
    ans = int(x/y)
    return ans
    
n= int(input())
a = [int(i) for i in input().split()]
m = max(a)

t = 0
t2 = 0
b = a[:]
b.remove(m)
for j in b:
    if j == 0:
        continue
    t3 = comb(m, j)
    if t < t3:
        t = t3
        t2 = j
print(str(m)+" "+str(t2))

### FIXED CODE ###

n= int(input())
a = [int(i) for i in input().split()]
ai = max(a)
b = [abs(int(i-ai/2)) if i != ai else 10E9 for i in a]
aj = a[b.index(min(b))]
print(str(ai)+" "+str(aj))
S = input()
s = list(S)
p = []
q = []
ans = [0 for i in range(len(s))]
for i in range(len(s)-1):
    if s[i] == 'L' and s[i+1] == 'R':
        p.append(i)
for i in range(len(s)-1):
    if s[i] == 'R' and s[i+1] == 'L':
        q.append(i)
if (p[0]-q[0])%2 == 0:
    ans[q[0]] = -(-(p[0]+1)//2)
else:
    ans[q[0]] = (p[0]+1)//2
ans[q[0]+1] = p[0]+1-ans[q[0]]
for i in range(len(p)-1):
    if (p[i+1]-q[i+1])%2 == 0:
        ans[q[i+1]] = -(-(p[i+1]-p[i])//2)
    else:
        ans[q[i+1]] = (p[i+1]-p[i])//2
    ans[q[i+1]+1] = p[i+1]-p[i]-ans[q[i+1]]
if (p[-1]-q[-1])%2 == 0:
    ans[q[-1]] = -(-(len(s)-p[-1]-1)//2)
else:
    ans[q[-1]] = (len(s)-p[-1]-1)//2
ans[q[-1]+1] = len(s) - p[-1] -1 - ans[q[-1]]
print(ans)

### FIXED CODE ###

S = input()
s = list(S)
p = []
q = []
ans = [0 for i in range(len(s))]
for i in range(len(s)-1):
    if s[i] == 'L' and s[i+1] == 'R':
        p.append(i)
for i in range(len(s)-1):
    if s[i] == 'R' and s[i+1] == 'L':
        q.append(i)
if len(p) > 0:
    if (p[0]-q[0])%2 == 0:
        ans[q[0]] = -(-(p[0]+1)//2)
    else:
        ans[q[0]] = (p[0]+1)//2
    ans[q[0]+1] = p[0]+1-ans[q[0]]
    for i in range(len(p)-1):
        if (p[i+1]-q[i+1])%2 == 0:
            ans[q[i+1]] = -(-(p[i+1]-p[i])//2)
        else:
            ans[q[i+1]] = (p[i+1]-p[i])//2
        ans[q[i+1]+1] = p[i+1]-p[i]-ans[q[i+1]]
    if (len(s)+1-q[-1])%2 == 0:
        ans[q[-1]] = -(-(len(s)-p[-1]-1)//2)
    else:
        ans[q[-1]] = (len(s)-p[-1]-1)//2
    ans[q[-1]+1] = len(s) - p[-1] -1 - ans[q[-1]]
else:
    if (len(s)+1-q[-1])%2 == 0:
        ans[q[-1]] = -(-(len(s))//2)
    else:
        ans[q[-1]] = (len(s))//2
    ans[q[-1]+1] = len(s) - ans[q[-1]]
for i in range(len(ans)):
    print(ans[i],end=' ')