peterverebics/CodeNet_Python_118 huggingface dataset:
S = input()
K = int(input())
s = int(S[0])
if K == 1:
  print(s)
else:
  if s == 1:
    print(int(S[1]))
  else:
    print(s)
import sys
import math

s=input()
k = int(input())
cnt = False
ans=0
for i in range(0,k):
    if s[i] != '1':
        ans = s[i]
        cnt = True
        break
    cnt+=1
if (not cnt):
    print(1)
else:
    print(ans)
def solve():
    for i in s:
        if i == 1:
            continue
        else:
            print(i)
            exit()
if __name__=="__main__":
    S = input()
    K = int(input())
#    d = 5*10**15
    s = [int(c) for c in S]
#    print(s)
    solve()
ns = list(map(int,input()))
n = int(input())

ans = 0

for i in range(len(ns)):
  if (ns[i] == 1 and n == 1) or ns[i] != 1:
    ans = ns[i]
    break
  else:
    continue
print(ans)
n = list(input())
m = int(input())
n = [int(x) for x in n]

if all([x==1 for x in n]):
    print("1")
    exit()
for i in range(len(n)):
    if n[i] != 1:
        print(n[i])
        break
s = input()
k = int(input())
b = list(map(int,s))
for i in b:
    if i!=1:
        print(i)
        break
else:print(1)
s = input()
k = int(input())

for i in s:
    if i != "1":
        ans = int(i)
        break
else:
    ans = 1

print(ans)
import sys
s = input()
k = int(input())
for i in range(len(s)):
    if s[i] != "1":
        print(s[i])
        sys.exit()
print("1")
s = input()
k = int(input())

for i in range(k):
    if s[i] != '1':
      print(s[i])
      break 
    else:
      print(1)
s = input()
k = int(input())
cnt = 0
for i in s:
    if i == "1":
        cnt += 1
    else:
        break
if cnt == 0:
    print(s[0])
elif k <= cnt:
    print("1")
else:
    print(s[1])
s = input()
k = int(input())

for v in range(k):
    if (s[v] == "2" or s[v] == "3" or s[v] == "4"):
        print(s[v])
        break
    if v+1 == k:
        print(1)
        break
S = list(input())
K = int(input())

for s in S:
    if s != '1':
        ans = s
        break
    else:
        ans = 1
        continue
print(ans)
s = input()
k = int(input())
for si in s:
    k -= int(si)*10**12*5000 if int(si) != 1 else 1
    if k <= 0:
        print(si)
        break
S = input()
ans = 0
for i in S:
    if i == "1":
        continue
    else:
        ans = i
        break
print(ans)
S=input()
K=int(input())
one = True
for i in range(len(S)):
  one = one and S[i]=='1'
  if not one: break
print(S[i])
# Problem C - To Infinity

# input
S = list(input())
s_len = len(S)
K = int(input())

# initialization
pos = 0
while K>0:
    K -= 1
    if int(S[pos])==1:
        pos += 1
    else:
        break
    if pos==s_len:
        pos -= 1
        break

# output
print(S[pos])
S = input()
K = int(input())
if S[0] == "1":
    if K == 1:
        print(1)
    else:
        S.replace("1", "")
        print(S[0])
else:
    print(S[0])
A = str(input())
B = input()
count = 0

for i in range(len(A)):
    if A[i] == 1:
        count += 1
    else:
        if count == B:
            print(1)
        else:
            print(A[i])
A = str(input())
B = input()
count = 0

for i in range(len(A)):
    if A[i] == 1:
        count += 1
    else:
        if count == B:
            print(1)
            break
        else:
            print(A[i])
            break
s = input()
k = int(input())
for si in s:
    if si != '1':
        print(si)
        break
# Problem C - To Infinity

# input
S = list(input())
s_len = len(S)
K = int(input())

# initialization
pos = 0
while K>0:
    K -= 1
    if int(S[pos])==1:
        pos += 1
    else:
        break
    if pos==s_len:
        pos -= 1
        break

# output
if K==0:
    print(S[pos-1])
else:
    print(S[pos])
s=input()
k=int(input())
cnt = 0
for i in s:
    if i =='1':
        cnt +=1
if cnt >=k:
    print(1)
    exit()
for i in s:
    if i !='1':
        print(i)
        exit()
s = input()
k = int(input())

if len(s) == 1 or k == 1: print(s[0])
else:
  if s[0] == "1": print(s[1])
  else: print(s[0])
S = list(input())
K = int(input())

for j, i in enumerate(S, start=1):
    if i != '1':
        if K <= j:
            print(1)
            exit()
        print(i)
        exit()
else:
    print(1)
S = input()
K = int(input())-1
if S[0] == '1' and K == 0:
    print('1')
elif S[0] == '1':
    print(S[1])
else:
    print(S[0])
S = input()
K = int(input())

if len(S) == 1:
    print(S)
else:
    for x in S:
        if x != "1":
            print(x)
            exit()
import bisect,collections,copy,itertools,math,string
import sys
def I(): return int(sys.stdin.readline().rstrip())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
def S(): return sys.stdin.readline().rstrip()
def LS(): return list(sys.stdin.readline().rstrip().split())
def main():
    s = S()
    k = max(len(s),I())

    ans = 1

    for i in range(k-1):
        if s[i] != "1":
            ans = s[i]
            break

    print(ans)
main()
ns = list(map(int,input()))
n = int(input())

ans = 0

for i in range(len(ns)):
  if ns[i] == 1:
    continue
  else:
    ans = ns[i]
    break
print(ans)
a=input()
b=int(input())
c=0
if a[0]!="1":
  print(a[0])
if a[0]=="1":
  for i in range(len(a)-1):
    if a[i]=="1" and a[i+1]=="1":
      c=c+1
    else:
      break
if c>b:
  print(1)
else:
  print(a[c])
import sys

S = input()
K = int(input())

for i in range(len(S)):
    if S[i] != "1":
        print(S[i])
        sys.exit()
print(1)
import sys
input = sys.stdin.readline

S = list(input().rstrip('\n'))
K = int(input())

n = 0
for i in range(len(S)):
    if S[i] != '1':
        if i+1 > K:
            n = 1
        else:
            n = int(S[i])
        break
print(n)
# -*- coding: utf-8 -*-
s = input()
k = int(input())

for i in range(k):
    if s[i] != '1':
        print(s[i])
        break
# https://atcoder.jp/contests/abc106/tasks/abc106_c

s = input()[:-1]
k = int(input())
repr(s)
for i in range(len(s)):
    if s[i] != '1':
        print(s[i])
        break
else:
    print('1')
n = list(input())
k = int(input())
if n.count('1') == len(n):
    print(1)
else:
    for i in n:
        if i != '1':
            print(i)
            exit()
s = input()
k = int(input())
for i in s:
    if i!= '1':
        print(i)
        break
s = input().strip()
k = int(input().strip())
days = 5 * (10 ** 15)
if len(s) == 1:
    print(s)
    exit()
before = 0
for i in range(0, len(s)):
    diff = 0
    if s[i] == "1":
        diff = 1
    else:
        for j in range(1, (days + 1), 1):
            if 10 ** 18 <= int(s[i]) ** j:
                diff = int(s[i]) ** j
                break
    if (k - 1) <= (before + diff):
        print(s[i])
        break
    else:
        before = before + diff
S = input()
for s in S:
  if s != '1':
    print(s)
    exit()
    
print('1')
import sys
s = input()
n = int(input())
if n == 1:
	print(s[0])
	sys.exit()
for i in s:
	if i != '1':
		print(i)
		sys.exit()
S = input()
K = int(input())

ans = 1
for i in S:
	print(i,K)
	if i > '1':
		ans = i
		break
	if K==1:
		ans = i
		break
	K-=1
print(ans)
s=input()
k=int(input())
for v in s:
    if v!='1':
        print(v)
        break
S = input().strip()
K = int(input())
ind = len(S)+1
for i in range(len(S)):
    if S[i]!="1":
        ind = i+1
        break
if K<=ind+1:
    print(1)
else:
    print(S[ind-1])
s = list(input())
k = int(input())
coun= 0

for i in range(k):
  coun += 1
  if s[i] != '1':
    print(i)
    exit()
  if coun == 100:
    print(1)
    exit()
s = input()
k = int(input())
if s[0]=='1':
  if k==1:
    print(s[0])
  else:
    print(s[1])
else:
  print(s[0])
s = input()
k = int(input())

if k == 1:
    print(s[0])
elif s[0] != '1':
    print(s[0])
else:
    print(s[1])
s = input()

for i in s:
  if i != "1":
    print(i)
    exit()
S=str(input())
K=int(input())
L=[1]*len(S)
count=0
#うしたぷにきあ君笑
for i in range(len(S)):
  if S[i]!='1':
    print(int(S[i]))
    exit()
S = input()
K = int(input())

for i in range(len(S)):
    if S[i] != '1': break

nth = i + 1
if K < nth:
    print(1)

answer = S[i]
print(answer)
s = str(input())
k = int(input())
if s[0] == '1':
    if k == 1:
        print(1)
    else:
        print(s[1])
else:
    print(s[0])
s = input()
k = int(input())
for i in s:
    if i != "1":
        print(i)
        break
print(1)
S = input()
K = int(input())
for i in S:
  if i != "1": 
    print(i)
    break
else: print("1")
s = input()
k = int(input())

if len(s) >= k and s == '1'*k:
    print(1)
else:
    for i in s:
        if i != '1':
            print(i)
            exit()
s=input()
k=int(input())
cnt = 0
for i in s:
    if i == '1':
        cnt +=1
if cnt >=k:
    print(1)
    exit()
for i in s:
    if i != '1':
        print(i)
        exit()
print(1)
s = input()
input()

found =  s.find('1')
if found == -1:
  print(s[0])
else:
  for e in s[found+1:]:
    if e != '1':
      print(e)
      break
s = str(input())
k = int(input())
num = 1
for i in s:
    if i != '1':
        num = i
        break
print(num)
S = input()
K = int(input())

if S[0] != 1 and len(S) != 1:
  print(S[1])
elif S[0] != 1 and len(S) == 1:
  print(S[0])
else:
  print(1)
s = list(str(input()))
k = int(input())

s = [int(i) for i in s]

for i,a in enumerate(s):
    if a == 1:
        continue
    elif i == k and i == 1:
        print(1)
        
    else:
        print(a)
        exit(0)
import sys
input = sys.stdin.readline

def main():
    S = input().strip()
    for s in S:
        if s != "1":
            print(s)
            exit()



if __name__ == '__main__':
    main()
s = input()
k = int(input())
k -= 1
cnt = 0

for i in range(len(s)):
    if s[i] == '1':
        cnt += 1
    else:
        break

if cnt < k:
    print(s[cnt])
else:
    print(1)
s=input()
k=int(input())
for i in range(len(s)):
    if s[i]!=1:
        print(s[i])
        break
s = input()
k = int(input())

for i, v in enumerate(s):
  if i == k-1:
      print(1)
      exit()
  elif v != 1: 
      print(v)
      exit()
s = input()
k = int(input())


if k == 1:
    print(s[0])
elif k >= 2 and s[0] == '1':
    print(s[1])
else:
    print(s[0])
s=input()
k=int(input())
cnt=0
if s[0]!="1":
	print(int(s[0]))
if s[0]=="1":
	for i in s:
		cnt+=1
		if i!="1":
			if cnt<=k:
				print(int(i))
				exit()
			else:
				print(1)
				exit()
S=input()
K=int(input())
count=0
for i in range(len(S)):
  if S[i]==1:
    count+=1
  else:
    break
if count>=K:
  print(1)
else:
  print(S[count])
s=input()

k=int(input())

if len(s) == 1:
    print(s)
elif s[0] == "1":
    print(s[1])
else:
    print(s[0])
s=input()
k=int(input())
sl=list(s)
for i in range(len(sl)):
    if s[i]!='1':
        print(s[i])
        exit()
    if k<len(sl):print(s[k])
S = input()
K = int(input())

if S[0] == "1" and len(S) > 1:
    print(S[1])
else:
    print(S[0])
s = list(input())
k = int(input())
if s[0] == "1":
    print(1)
elif len(s) == 1:
    print(s)
else:
    print(s[0])
import sys
s = list(input())
k = int(input())
if len(s) == 1:
    print(s)
elif k == 1:
    print(s[0])
else:
    for i in range(k):
        if s[i] != "1":
            print(s[i])
            sys.exit()
    print(1)
s = input()
k = int(input())

for i, v in enumerate(s):
  if i == k-1:
      print(1)
      exit()
  elif v != "1": 
      print(v)
      exit()
s = str(input())
S = [int(s[i]) for i in range(len(s))]
K = int(input())
ans = 1
count = 0
for i in range(len(S)):
    if S[i] != 1 and count == 0:
        ans = S[i]
        count += 1
print(ans)
url = "https://atcoder.jp//contests/abc106/tasks/abc106_c"

def main():
    s = input()
    k = int(input())
    ans = 0
    tyou = 500000000000000
    for v in s:
        if v == '1':
            continue
        ans += tyou ** int(v)
        if ans >= k:
            print(v)
            exit()



if __name__ == '__main__':
    main()
numstr = input()
num = int(input())
def check():
    infinity = ""
    for i in range(len(numstr)):
        if numstr[i] is not "1":
            infinity = infinity + numstr[i]
            return infinity
        else:
            infinity = infinity + "1"
    return "1"
infinity = check()
print(infinity[len(infinity)-1])
S = [i for i in input()]
K = int(input())

if S[0]!='1':
    print(S[0])
else:
    for i in range(len(S)):
        if S[i]!='1':
            print(S[i])
            break
def resolve():
    S = input()
    s = [int(c) for c in S]
    K = int(input())
    
    if len(s) == 1:
        print(s[0])
    else:
        if K == 1:
            print(s[0])
        else:
            for i in range(len(s)):
                if s[i] != 1:
                    print(s[i])
                    break


resolve()
S = input()
K = int(input())

for i in range(len(S)):
    if S[i] != "1":
        print(S[i])
        break
    else:
        if i == K - 1:
            print("1")
s = input()
k = int(input())

if len(s) == 1:
    print(s)
    exit()

if s[0] == "1" and k == 1:
    print(1)
elif s[0] == "1" and k != 1:
    print(s[1])
elif s[0] != "1":
    print(s[0])
# row = [int(x) for x in input().rstrip().split(" ")]
# n = int(input().rstrip())
# s = input().rstrip()

def resolve():
    import sys
    input = sys.stdin.readline

    s = input().rstrip()
    k = int(input().rstrip())

    i = 0
    for c in s:
        if c != "1":
            break
        if i == k:
            break
        i += 1

    print(c)


if __name__ == "__main__":
    resolve()
s = input()
k = int(input())
if s[0] == '1' and k > 1:
  print(s[1])
else:
  print(s[0])
S = str(input())
K = int(input())

gosencho = 5 * (10**15)

for i in range(len(S)):
        if K <= 0:
                print(S[i-1])
                exit(0)
        elif S[i] != '1':
                K -= int(S[i]) * gosencho
        else:
                K -= 1

print(S[-1])
S = input()
K = int(input())

if K == 1:
    print(S[0])
elif S[0] == '1' and K != 1:
    print(S[1])
else:
    print(S[0])
a = input()
b = int(input())
cnt = b
for i in a:
  if cnt != 0:
    if i == "1":
      cnt -= 1
    else:
      print(i)
      break
  else:
    print("1")
    break
a = input()
k = int(input())
b = list(a)
if k == 1:
    print(b[0])
elif int(b[0]) == 1:
    print(b[1])
else:
    print(b[0])
S = list(input())
K = int(input())

if len(S) == 1 or K == 1:
    print(S[0])

elif S[0] == 1 and K >= 2:
    print(S[1])

elif S[1] != 1 and K >= 2:
    print(S[0])
def main():
    S = input()
    K = int(input())
    # 10**15
    if S[0] == '1':
        if K == 1:
            print(S[0])
        else:
            print(S[1])
    else:
        print(S[0])


if __name__ == '__main__':
    main()
S = input()
if len(S) == S.count("1"):
    print(1)
else:
    for c in S:
        if c != "1":
            print(c)
            break
def resolve():
	s = input()
	k = int(input())
	if len(s) == 1:
		print(s)
		return

	for i in s:
		if int(i) == 1:
			continue
		print(i)
		return
	print(s[0])
resolve()
s=input()
k=input()

if s[0]=='1':
    if len(s)>1:
        print(s[1])
    else:
        print(1)
else:
    print(s[0])
def resolve():
	s = input()
	k = int(input())
	for i in s:
		if int(i) == 1:
			continue
		print(i)
		return
resolve()
S = list(input())
K = int(input())

if len(S) == 1 or K == 1:
    print(S[0])

elif S[0] == 1:
    print(S[1])

else:
    print(S[0])
S = input()
K = input()
ans = -1
for i, s in enumerate(S):
    if i == K:
        ans = s
        break
    if s == '1':
        continue
    else:
        ans = s
        break

print(ans)
a=input()
b=int(input())
c=1
if a[0]!="1":
  print(a[0])
if a[0]=="1":
  for i in range(len(a)-1):
    if a[i]=="1" and a[i+1]=="1":
      c=c+1
    else:
      break
if c>b:
  print(1)
else:
  print(a[c-1])
s=str(input())
n=int(input())
if(n==1 and s[0]=='1'):
    print(1)
elif(s[0]!='1'):
    print(s[0])
else:
    print(s[1])
S = list(map(int, input()))
K = int(input())
if len(S) == 1:
    print(S[0])
    exit()

cnt = 0
for s in S:
    if s == 1:
        cnt += 1
if K <= cnt:
    print(1)
else:
    print(S[cnt])
S = list(input())
K = int(input())
ans = 1

for i in range(len(S)):
    if S[i] != 1 :
        ans = S[i]
        break
print(ans)
s=input()
k=int(input())

if k==1:
    print(int(s[0]))
elif int(s[0])==1:
    num=1
    for i in range(len(s)):
        if int(s[i])!=1:
            num=int(s[i])
            break

    print(num)
elif int(s[0])!=1:
    print(int(s[0]))
s=list(map(int,list(input())))
k=int(input())
if s[0]!=1:print(s[0])
elif len(s)>1 and k>1:print(s[1])
else:print(1)
def main():
    s = input()
    k = int(input())

    for i in range(len(s)):
        if s[i] != "1":
            print(s[i])
            break
    else:
        print(1)


if __name__ == "__main__":
    main()
S = input()
K = int(input())

ans = '1'
if K == 1:
    ans = S[0]
else:
    for i in S:
        if i == ans:
            continue
        else:
            ans = i
            break

print(ans)
s=list(input())
k=int(input())
for i in range(len(s)):
    if s[i] != "1":
        print(s[i])
        break
else:
    print(1)
S = input()
K = int(input())
if len(S) == 1:
    ans = int(S)
elif S[0] == '1' and K == 1:
    ans = 1
elif S[0] != '1':
    ans = int(S[0])
else:
    ans = int(S[1])
print(ans)
s = list(input())
k = int(input())
for i in range(k):
    if s[i] != 1:
        l = [i for i in s if i != 1]
        print(l[0])
        break
else:
    print(1)
S = input()
K = int(input())

if sum(map(int, list(S[:K]))) == K:
    print(1)
else:
    for si in S:
        if si != '1':
            print(si)
            break
s = input()
k = int(input())
ans = 1
for i in range(len(s)):
    if s[i] != '1':
        ans = int(s[i])
        break
print(ans)
s = list(input())
k = int(input())


for i in range(k):

    if str(s[i]) != 1:
        print(i)
        exit()
print(1)
s = input()
k = int(input())
for i in s:
    if i != "1":
        print(i)
        exit()
print(1)
s=input()
k=int(input())
for i in range(len(s)):
  if s[i]!=1:
    print(s[i])
    exit()
print(1)
s = list(input())
s = [int(l) for l in s]
k = int(input())

s_set = set(s)

if s[0] > 1:
  print(s[0])
elif sum(s_set) == 1:
  print(1)
else:
  i = 0
  while s[i] == 1:
    i += 1
    if s[i] != 1:
      print(s[i])
      break
s = list(input())
k = int(input())

n_L = s[:k]
for i in n_L:
    if i != 1:
        print(i)
        exit()
print(1)
S = input()
K = int(input())

if len(S) == '1':
    print(S)
    exit()

if K == 1:
    print(S[0])
    exit()

for i in S:
    if i != '1' and K != 1:
        print(i)
        exit()
s=input()
k=int(input())
sl=list(s)
for i in range(len(sl)):
    if s[i]!='1':
        print(s[i])
        exit()
    if k<len(sl):print(s[k-1])
def To_Infinity(s , k):

    ans = 0

    if int(s[0]) == 1:
        if k == 1:
            ans = 1
        else:
            ans = s[1]
    else:
        ans = s[0]

    return ans
def main():
    s = list(str(input()))
    k = int(input())
    print(To_Infinity(s , k))

if __name__ == '__main__':
    main()
S = input()
print(S) if len(S) == 1 else print([S[0],S[1]][S[0] == '1'])
S = str(input())
K = int(input())

gosencho = 5 * (10**15)

for i in S:
        if i != '1':
                K -= int(i) * gosencho
        else:
                K -= 1
        if K <= 0:
                print(i)
                exit(0)
S = input()
K = int(input())
if K == 1 and S[0] == '1':
    print(S[0])
    exit()
for i in range(len(S)):
    if S[i] != '1':
        print(S[i])
        exit()
S = input()
K = int(input())

if len(S) == 1:
    print(S)
    exit()

if K == 1:
    print(S[0])
    exit()

for i in S:
    if i != '1' and K != 1:
        print(i)
        exit()

print(1)
s = list(map(str, input().rstrip()))
_ = int(input())

ans = 1
for x in s:
    if int(x) != 1:
        ans = int(x)
        break
print(ans)
s = input()

k = int(input())

tyou = 5000000000000000

for i in range(len(s)):
    if int(s[i]) == 1:
        pass
    else:
        print(s[i])
        exit()
import sys
input = sys.stdin.readline

S = list(input().rstrip('\n'))
K = int(input())

n = 0
for i in range(len(S)):
    if S[i] != '1':
        if K < i+1:
            n = 1
        else:
            n = int(S[i])

        break
print(n)
numstr = input()
num = int(input())
def check():
    for i in range(len(numstr)):
        if numstr[i] != 1:
            return numstr[i]
print(check())
import sys

input = sys.stdin.readline

def main():
    ans = 0
    s = input().rstrip('\n')
    k = int(input())
    for i in range(len(s)):
        if s[i] != '1':
            if k < i+1:
                ans = s[i]
            else:
                ans = '1'
    print(ans)

if __name__ == '__main__':
    main()
S=input()
K=int(input())

if len(S)==1:
    print(S)
    quit()

i=0
while i<len(S):
    if S[i]!="1":
        print(S[i])
        quit()
    i+=1
s = input()
k = int(input())
ans = 0
for i in range(len(s)):
  if int(s[i]) != 1:
    ans = int(s[i])
    break
  else:
    next
print(ans)
# -*- coding: utf-8 -*-
s = input()
k = int(input())

for i in range(k):
    if s[i] != '1':
        print(s[i])
        break
print(1)
s = input()
k = int(input())
if(k-1 < len(s)):
    if(s[k-1] == '1'):
        print(1)
        exit()
for i in s:
    if(i != '1'):
        print(i)
        exit()
def main():
    S = input()
    K = int(input())
    idx = 0
    num = ""

    for i in range(len(S)):

        idx = i
        num = S[i]

        if S[i] != "1":
            break

    if idx >= K - 1:
        print("1")
    else:
        print(num)

if __name__ == "__main__":
    main()
S=input()
K=int(input())
kazu=5*10**5

for i in range(len(S)):
    print(K)
    if K<=int(S[i])**kazu:
        print(int(S[i]))
        break
    else:
        K-=int(S[i])**kazu
S=input()
K=float(input())
lis=list(S)
ss=set(lis)

if len(ss)==1:
  print(S[0])
else:
  for num in lis:
    if int(num)!=1:
      print(num)
      break
S = list(input())
S = [int(s) for s in S]

K = int(input())

num_digit = 0

for s in S:
    if s == 1:
        num_digit += 1
    else:
        num_digit += s * 5 * 10**15

    if num_digit >= K:
        print(s)
        break
S = input()
K = int(input())

ans = "1"
for i in range(len(S)):
    if S[i] != "1":
        ans = S[i]
        break

print(ans)
c = 5*pow(10, 14)
list_N = list(input())
k = int(input())
cnt = 0
ans = 0

for i in list_N:
    i = int(i)
    cnt += pow(i, c)
    if cnt > k:
        ans = i
        break

print(ans)
s=int(input())
s=list(str(s))
k=int(input())
i=0
while True:
  if i==len(s):
    print(1)
    break
  if s[i]!="1":
    print(s[i])
    break
  else:
    i=i+1
  if i==k-1:
    print(1)
    break
S=input()
K=int(input())
kazu=5*10**5

for i in range(len(S)):
    if K<=int(S[i])**kazu:
        print(int(S[i]))
        break
    else:
        K-int(S[i])**kazu
S=input()
K=int(input())
N=len(S)
for i in range(N):
    if not(S[i]=="1"):
        print(S[i])
        break
s = list(map(int,input()))
k = int(input())
if k == 1:
    print(s[0])
else:
    if s[0] == 1:
        print(s[1])
    else:
        print(s[0])
S=input()
K=int(input())
N=len(S)
if N==1:
	print(S)
else:
	if S[0]=="1":
		print(S[1])
	else:
		print(S[0])
s = str(input())
k = int(input())
ans=0
for x in s:
  if(int(x)==1):
    continue
  else:
    ans=int(x)
    break
print(ans)
def main():
    import sys
    #input = sys.stdin.readline
    sys.setrecursionlimit(10000000)
    from collections import Counter, deque
    #from collections import defaultdict
    from itertools import combinations
    #from itertools import accumulate, product, permutations
    from math import floor, ceil

    #mod = 1000000007

    s = input()
    input()
    n = 0
    while n<len(s):
        if not s[n]=='1':
            print(s[n])
            exit()
        else:
            n += 1
    print('1')


if __name__ == '__main__':
    main()
# -*- coding: utf-8 -*-
import sys
sys.setrecursionlimit(10**9)
INF=10**18
MOD=10**9+7
def input(): return sys.stdin.readline().rstrip()

def main():
    S=list(map(int,list(input())))
    K=int(input())
    for n in S:
        if n==1:
            K-=1
            if K==0:
                print(0)
                exit()
        else:
            print(n)
            exit()

if __name__ == '__main__':
    main()
# coding = SJIS

s = str(input())
k = int(input())

ans = 1

for i in s:
    if int(i) != 1:
        print(i)
        exit()

print(ans)
s=input()
k=int(input())

if k==1:
    print(s[0])
elif s[0]==1:
    print(s[1])
else:
    print(s[0])
S = list(input())
K = int(input())

for i in S:
    if i != "1":
        print(i)
        exit()
print(1)