Problem:
 ﻿Score: 300 points    Problem Statement  Mr. Infinity has a string S consisting of digits from 1 to 9 . Each time the date changes, this string changes as follows:   Each occurrence of 2 in S is replaced with 22 . Similarly, each 3 becomes 333 , 4 becomes 4444 , 5 becomes 55555 , 6 becomes 666666 , 7 becomes 7777777 , 8 becomes 88888888 and 9 becomes 999999999 . 1 remains as 1 .   For example, if S is 1324 , it becomes 1333224444 the next day, and it becomes 133333333322224444444444444444 the day after next.
You are interested in what the string looks like after 5 \times 10^{15} days. What is the K -th character from the left in the string after 5 \times 10^{15} days?      Constraints   S is a string of length between 1 and 100 (inclusive).  K is an integer between 1 and 10^{18} (inclusive).  The length of the string after 5 \times 10^{15} days is at least K .         Input  Input is given from Standard Input in the following format:  S  K       Output  Print the K -th character from the left in Mr. Infinity's string after 5 \times 10^{15} days.        Sample Input 1 1214
4      Sample Output 1 2  The string S changes as follows:   Now: 1214  After one day: 12214444  After two days: 1222214444444444444444  After three days: 12222222214444444444444444444444444444444444444444444444444444444444444444   The first five characters in the string after 5 \times 10^{15} days is 12222 . As K=4 , we should print the fourth character, 2 .       Sample Input 2 3
157      Sample Output 2 3  The initial string is 3 . The string after 5 \times 10^{15} days consists only of 3 .       Sample Input 3 299792458
9460730472580800      Sample Output 3 2

Solution (Python):
import sys
import math
from collections import defaultdict, deque, Counter
from copy import deepcopy
from bisect import bisect, bisect_right, bisect_left
from heapq import heapify, heappop, heappush

input = sys.stdin.readline
def RD(): return input().rstrip()
def F(): return float(input().rstrip())
def I(): return int(input().rstrip())
def MI(): return map(int, input().split())
def MF(): return map(float,input().split())
def LI(): return list(map(int, input().split()))
def TI(): return tuple(map(int, input().split()))
def LF(): return list(map(float,input().split()))
def Init(H, W, num): return [[num for i in range(W)] for j in range(H)]

def mod_pow(x,n):
    res = 1
    while n > 0:
        if n & 1:
            res = res * x
            x = x * x
            n >>= 1
    return res


def main():
    S = input().rstrip()
    K = I()
    for i in range(len(S)):
        if int(S[i]) >= 2 or K == 1:
            print(S[i])
            break
        else:
            K -= 1
            
        
    
    
if __name__ == "__main__":
    main()

Solution (Python):

import sys
input=sys.stdin.readline

def main():
    S = input().rstrip()
    k = int(input())
    
    for i in range(k):
        if S[i]!="1":
            break
    print(S[i])

if __name__=="__main__":
    main()

Solution (Python):
S = input()
K = int(input())
for i in range(K):
    if S[i] != "1":
        print(S[i])
        exit()
print(1)

Solution (Python):









def solve(S, K):
    ans = ''
    for i in range(len(S)):
        if i + 1 == K:
            ans = S[i]
            break
        if S[i] != '1':
            ans = S[i]
            break
    print(ans)


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

Solution (Python):
s = input()
k = int(input())

if k == 1 or len(s) == 1:
    ans = list(s)[0]
else:
    ans = None
    for i, j in enumerate(list(s)):
        if i < k-1:
            if j != '1':
                ans = j
                break
        elif i == k-1:
            ans = j           
            break
        else:
            continue
print(ans)

Solution (Python):



def main():
    S = input()
    K = int(input())
    ans = '1'
    tmp = -1
    for i, s in enumerate(S):
        if s != '1':
            ans = s
            break
        else:
            tmp = i

    if K - 1 <= tmp:
        ans = '1'

    print(ans)

if __name__ == "__main__":
    main()

Solution (Python):
S = input()
K = int(input())
P = len(S) + 1
Q = ""
for i in range(len(S)):
  if S[i] != "1":
    P = i + 1
    Q = S[i]
    break
if K < P:
  print(1)
else:
  print(Q)

Solution (Python):
s=input()
k=int(input())
for i in range(min(k,len(s))):
  if s[i] != "1":
    print(s[i])
    break
else:
  print("1")

Solution (Python):
import sys
def input():
  return sys.stdin.readline().rstrip()

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

ichi=0
for i in range(len(S)):
  if S[i]=="1":
    ichi+=1
  else:
    break

print(1 if K<=ichi else S[ichi])

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


if __name__ == '__main__':
    main()

Solution (Python):
S = str(input())
K = int(input())
for i in range(K):
    if S[i] != "1":
        break
else:
    while S[i] != "1":
        i += 1
        
print(S[i])

Solution (Python):
s = input()
k = int(input())
one_cnt = 0

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

if k <= one_cnt:
  print(1)
  exit()

for i in range(len(s)):
  if s[i] != '1':
    print(s[i])
    exit()

Solution (Python):
s = input()
k = int(input())

if k == 1:
    print(int(s[0]))
elif s[0] == "1":
    cnt = 0
    while  cnt < len(s) and s[cnt] == "1" :
        cnt += 1
    if cnt >= k:
        print(1)
    elif cnt == len(s):
        print("1")
    else:
        print(s[cnt])
else:
    print(int(s[0]))

Solution (Python):
import sys

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


s=list(s)

c=0
for i in range(len(s)):
        if s[i]=='1':
                c+=1
if c==len(s):
        print('1')
        sys.exit()

d=0
if len(s)>=k:
        for i in range(k):
                if s[i]=='1':
                        d+=1
if d==k:
        print('1')
        sys.exit()

for i in range(len(s)):
        if s[i]!='1':
                print(s[i])
                sys.exit()

Solution (Python):
S = input()
K = int(input())

for i,s in enumerate(S):
  if s != "1" and i < K: 
    print(s)
    exit()
print(1)

Solution (Python):
s = input()
k = int(input())

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

Solution (Python):
import sys



def input():
    return sys.stdin.readline().strip()


def input_int():
    return int(input())


def input_int_list():
    return [int(i) for i in input().split()]


def main():
    S = input()
    k = input_int()
    one = 0
    for s in S:
        if s == "1":
            one += 1
        else:
            tmp = s
            break
    if k <= one:
        print(1)
    else:
        print(tmp)

    return


if __name__ == "__main__":
    main()

Solution (Python):
S = input()
K = int(input())

for i in range(len(S)):
  if S[i] != "1":
    print(S[i])
    break
  elif i+1 < K and S[i] == "1":
    continue
  else:
    print(1)
    break

Solution (Python):
S = input()
K = int(input())

l = 0
for i in range(len(S)):
    if S[i] == '1':
        l += 1
    if l >= K:
        print(S[i])
        exit()
    if S[i] != '1':
        print(S[i])
        exit()

Solution (Python):
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 7)

s = [i for i in input().strip()]
k = int(input())

while k:
    v = s.pop(0)
    if v != '1':
        print(v)
        sys.exit(0)
    else:
        k -= 1
print(1)

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

Solution (Python):

"""
Created on Wed Sep 16 01:17:00 2020

@author: liang
"""

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


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


if K < i + 1:
    print(1)
    
else:
    print(S[i])

Solution (Python):
S=input()
K=int(input())

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

if K<i+1:
    print(1)
else:
    print(S[i])

Solution (Python):
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 = min(len(s),I())

    ans = 1

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

    print(ans)
main()

Solution (Python):
s = input()
k = int(input())

s1=0
sn1='0'
for i in range(len(s)):
    if(s[i] == '1'):
        s1+=1
    else:
        sn1=s[i]
        break
ans='0'
if(s1>=k):
    ans='1'
else:
    ans=sn1

print(ans)

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

Solution (Python):
txt = input()
n = int(input())
for i in range(n):
  if txt[i] != '1':
    print(txt[i])
    break
else:
  print("1")

Solution (Python):
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])

Solution (Python):
S=input()
K=int(input())
one=0
for i in range(len(S)):
    if S[i]=='1':
        one+=1
    else:
        break
if K<=one:
    print('1')
else:
    print(S[one])

Solution (Python):
def main():
    S = list(map(int, list(input().rstrip())))
    K = int(input())
    if sum(S[:K]) == K and len(set(S[:K])) == 1:
        print(1)
    else:
        for s in S:
            if s != 1:
                print(s)
                exit()


if __name__ == '__main__':
    main()

Solution (Python):
s=input()
k = int(input())
cnt = 0
for i in s:
    if i == '1':
        cnt +=1
    else:
        x = i
        break
if cnt >= k:
    print(1)
else:
    print(x)

Solution (Python):




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

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

    for i in range(k):
        if s[i] != "1":
            print(s[i])
            return

    print(1)


if __name__ == "__main__":
    resolve()

Solution (Python):
s = input()
k = int(input())

for i, x in enumerate(s):
    if x == '1':
        if k == i + 1:
            print(1)
            exit()
    else:
        print(x)
        exit()

Solution (Python):
N = input()
K = int(input())
ans = '1'
for i in range(K):
  if i >= len(N):
    break
  if N[i] != '1':
    ans = N[i]
    break
print(ans)

Solution (Python):
S = input()
K = int(input())


cnt = 0

for i in range(len(S)):
    if int(S[i]) == 1:
        cnt += 1
    else:
        if cnt >= K:
            print(1)
        else:
            print(int(S[i]))
        exit()

print(1)

Solution (Python):
N = list(input())
N = [int(N[i]) for i in range(len(N))]
K = int(input())
if len(N) < K:
  for i in range(len(N)):
    if not N[i] == 1:
      print(N[i])
      break
  else:
    print(1)
else:
  for i in range(K):
    if not N[i] == 1:
      print(N[i])
      break
  else:
    print(1)

Solution (Python):
n=input()
k=int(input())

for i in range(len(n)):
    if n[i]=="1" :
        k-=1
        if k==0 :
            print(1)
            break
    else :
        print(n[i])
        break

Solution (Python):
s = input()
k = int(input())

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

Solution (Python):
s=str(input())
k=int(input())
con=0
for i in s:
  if i=="1":
    con+=1
  else:
    break
if con>=k:
  print(1)
else:
  print(i)

Solution (Python):
S = input()
K = int(input())
con = 0
for i in S:
  if i == '1':
    con += 1
  else:
    break
if con >= K:
  print(1)
else:
  print(i)

Solution (Python):
S = input()
K = int(input())
def main():
    cnt = 1
    for i in S:
        if i == '1':
            if K == cnt:
                return '1'
            else:
                cnt += 1
                continue
        else:
            return i
        return '1'
print(int(main()))

Solution (Python):
S = input()
N = len(S)
K = int(input())

if S[:min(N,K)] == "1" * min(N,K):
    ans = 1
else:
  for i in range(N):
    if S[i] != "1":
      ans = S[i]
      break
      
print(ans)

Solution (Python):
s = list(input())
s = list(map(int,s))
k = int(input())
for _ in s[:k]:
    if _ != 1:
        print(_)
        exit(0)
print(1)

Solution (Python):
s = input()
k = int(input())
for i in range(k):
    if s[i]!='1':
        print(s[i])
        exit()
print(s[k-1])

Solution (Python):
s=input()
i=1
while 1:
    if i==len(s)+1:
        print(1);exit()
    if s[i-1]!="1":
        t=i 
        ans=int(s[i-1])
        break
    i+=1

if int(input())<t:
    print(1);exit()
print(ans)

Solution (Python):
s=input()
k=int(input())
ans=1
for i in range(k):
  if s[i]!='1':
    ans=int(s[i])
    print(ans)
    exit()
print(1)

Solution (Python):
S = input()
K = int(input())

ans = 1
for i in range(len(S)):
    if int(S[i]) > 1 and i < K:
        ans = int(S[i])
        break
        
print(ans)

Solution (Python):
S=input()
K=int(input())
i=0
while S[i]=='1' and K>i+1 and i<len(S):
  i+=1
if i==len(S):
  i=0
print(S[i])

Solution (Python):
S = list(input())
K = int(input())
lsS = [int(i) for i in S]
ii = 0
for i in range(len(S)):
    if lsS[i] == 1:
        ii += 1
    else:
        a = lsS[i]
        break
if ii >= K:
    print(1)
else:
    print(a)

Solution (Python):
S=input()
a=int(input())
List=list(S)
res = 1
for i in range(a):
  if List[i] != "1":
    res = List[i]
    break
print(res)

Solution (Python):
s = list(input())
k = int(input())
num_list = [int(i) for i in s]
ans = 1
for i in range(k):
    if num_list[i] != 1:
        ans = num_list[i]
        break
print(ans)

Solution (Python):
def main():
    s = input()
    k = int(input())
    index = k + 1

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

    if index < k:
        print(s[index])
    else:
        print(1)


if __name__ == "__main__":
    main()

Solution (Python):
s = list(input())
k = int(input())
num_list = [int(i) for i in s]
ans = 1
for i in range(k):
    if num_list[i] != 1:
        ans = num_list[i]
        break
print(ans)

Solution (Python):
s=input()
k=int(input())
d=5*10**15
for i in s:
  if i=='1':
    k-=1
  else:
    print(i)
    exit()
  if k<=0:
    print(1)
    exit()

Solution (Python):

import sys
def input():
    return sys.stdin.readline()[:-1]

def main():
    S = input()
    K = int(input())

    if K >= 1e3:
        K = 105

    T = ''
    for i in range(len(S)):
        if S[i] == '1':
            T += '1'
        else:
            T += S[i] * K

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

    print(T[K - 1])


if __name__ == '__main__':
    main()

Solution (Python):

import sys
def input():
    return sys.stdin.readline()[:-1]

def main():
    S = input()
    K = int(input())

    if K >= 1e3:
        K = 105

    T = ''
    for i in range(len(S)):
        if S[i] == '1':
            T += '1'
        else:
            T += S[i] * K

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

    print(T[K - 1])


if __name__ == '__main__':
    main()

Solution (Python):
S = input()
K = int(input())

ans = 1
for i in range(K):
    if int(S[i]) != 1:
        ans = S[i]
        break
print(ans)

Solution (Python):
S = [int(i) for i in input()]
K = int(input())

if sum(S)==len(S):
    print(1)
else:
    for i in range(len(S)):
        if S[i]!=1:
            print(S[i])
            break
        elif S[i]==1 and K-1<=i:
            print(1)
            break

Solution (Python):
import sys, math
lines = [s.rstrip("\n") for s in sys.stdin.readlines()]
s = lines.pop(0)
k, = [int(num) for num in lines.pop(0).split(" ")]
days = 5000 * (10 ** 12)
for n in s:
    log_k = math.log10(k)
    n = int(n)
    log_n_days = math.log10(n) * days
    if log_k > log_n_days:
        k -= n ** days
    else:
        break
print(n)

Solution (Python):
from collections import defaultdict,deque
import sys,heapq,bisect,math,itertools,string,queue,datetime
sys.setrecursionlimit(10**8)
INF = float('inf')
mod = 10**9+7
eps = 10**-7
def inpl(): return list(map(int, input().split()))
def inpl_s(): return list(input().split())

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

for i in range(K):
	if S[i] == '1':
		continue
	else:
		print(S[i])
		sys.exit()

print(S[K-1])

Solution (Python):
s = input()
k = int(input())
n = 5000 * 10**12

for i, c in enumerate(s):
    if c != '1':
        print(c)
        break
    if i + 1 == k:
        print(1)
        break

Solution (Python):
s=input()
k=int(input())
for i in range(min(k,len(s))):
    if s[i]!="1":
        print(s[i])
        exit()
print(1)

Solution (Python):
S = input()
K = int(input())
count = 0

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

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

if count >= K:
  print(1)
else:
  print(S[count])

Solution (Python):
s = input()
k = int(input())
i = 0
while True:
  if s[i] == '1':
    if k <= i+1:
      print('1')
      break
    else:
      i += 1
  else:
    print(s[i])
    break

Solution (Python):
S = list(input())
K = int(input())
ans = 1

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

Solution (Python):
S = input()
K = int(input())

for i in range(K):
    if S[i] != '1':
        print(S[i])
        exit()
    
    if i == K - 1:
        print('1')
        exit()

Solution (Python):
import sys
input = sys.stdin.readline

S=input().strip()
K=int(input().strip())

n = 0
m = 0
for c in S:
    if c != '1':
        m = int(c)
        break
    n += 1
if K <= n:
    print(1)
else:
    print(m)

Solution (Python):
S = input()
K = int(input())


for i in range(K):
    if S[i] != "1":
        print(S[i])
        break
    if i == K-1:
        print(S[K-1])

Solution (Python):
s = input()
k = int(input())

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

Solution (Python):
s = input()
k = int(input()) - 1


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

print(s[i])

Solution (Python):
S = input()
K = int(input())
one = 0

for s in S:
  if s=="1":
    one+=1
  else:
    ans = s
    break

if K<=one:
  print(1)
else:
  print(ans)

Solution (Python):
s = str(input())
k = int(input())
if s[:k].count('1') == len(s[:k]):
    print(1)
else:
    for i in s:
        if i != '1':
            print(i)
            break

Solution (Python):
s = input()
k = int(input())
cnt = 0
for j in range(len(s)):
	cnt += 1
	if s[j] == "1":
		if cnt == k:
			print("1")
			exit()
	else:
		print(s[j])
		exit()

Solution (Python):
s = str(input())
k = int(input())
len_s = len(s)
cnt_1 = 0
for i in range(len_s):
    if s[i] == '1':
        cnt_1 += 1
    else:
        moji = s[i]
        break
if cnt_1 >= k:
    print(1)
else:
    print(s[i])

Solution (Python):
s=list(input())

k=int(input())

cnt=0
ans=0
for i in s:
  if int(i)==1:
    cnt+=1
    continue
    
  else:
    ans+=int(i)
    break
    
if k<=cnt:
  print(1)
  
else:
  print(ans)

Solution (Python):

S = input().rstrip()
K = int(input())


for s in S[:K]:
    if s != '1':
        print(s)
        exit()
print(1)

Solution (Python):
S = input().rstrip()
K = int(input())
for s in S[:K]:
    if s!="1":
        print(s)
        exit()
print(1)

Solution (Python):
s=input()
k=int(input())
if s[0]!="1":
    print(s[0])
else:
    cnt=0
    for i in range(len(s)):
        if s[i]=="1":
            cnt+=1
        else:
            break
    if cnt>=k:
        print(1)
    else:
        print(s[cnt])

Solution (Python):
s = input()
k = int(input())

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

Solution (Python):
def examA():
    N = DI()/dec(7)
    ans = N
    print(N)
    return

def examB():
    ans = 0
    print(ans)
    return

def examC():
    S = SI()
    K = I()
    ans = "1"
    for i,s in enumerate(S,start=1):
        if s!="1":
            ans = s
            break
        if i==K:
            ans = s
            break
    print(ans)
    return

def examD():
    ans = 0
    print(ans)
    return

from decimal import getcontext,Decimal as dec
import sys,bisect,itertools,heapq,math,random
from copy import deepcopy
from heapq import heappop,heappush,heapify
from collections import Counter,defaultdict,deque
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
def I(): return int(input())
def LI(): return list(map(int,sys.stdin.readline().split()))
def DI(): return dec(input())
def LDI(): return list(map(dec,sys.stdin.readline().split()))
def LSI(): return list(map(str,sys.stdin.readline().split()))
def LS(): return sys.stdin.readline().split()
def SI(): return sys.stdin.readline().strip()
global mod,mod2,inf,alphabet,_ep
mod = 10**9 + 7
mod2 = 998244353
inf = 10**18
_ep = dec("0.000000000001")
alphabet = [chr(ord('a') + i) for i in range(26)]
alphabet_convert = {chr(ord('a') + i): i for i in range(26)}

getcontext().prec = 28

sys.setrecursionlimit(10**7)

if __name__ == '__main__':
    examC()

"""
142
12 9 1445 0 1
asd dfg hj o o
aidn
"""

Solution (Python):
s=input()
k =int(input())
for i in range(k):
    if s[i] != '1':
        ans = s[i]
        break
    elif i < k-1:
        ans = s[i+1]
    else:
        ans = s[i]
        
print(ans)

Solution (Python):
s=input()
k=int(input())
t=0
one=0
for i in s:
  if i=="1":
    one+=1
  else:
    t=i
    break
if k<=one:
  print(1)
else:
  print(t)

Solution (Python):


import sys
def I(): return int(sys.stdin.readline().rstrip())
def LI2(): return list(map(int,sys.stdin.readline().rstrip()))  

S = LI2()
K = I()

for i in range(K):
    if S[i] != 1:
        print(S[i])
        break
    elif i == K-1 and S[i] == 1:
        print(1)

Solution (Python):
S = input()
K = int(input())

idx = min(K, len(S))
for s in S[:idx]:
    if s != "1": 
      print(s)
      break
else:
  print(1)

Solution (Python):
s = input()
k = int(input())

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

Solution (Python):
import sys


def input():
    return sys.stdin.readline().rstrip()


def main():
    S = input()
    K = int(input())

    i = 0

    for i in range(K):
        if S[i]=="1":
            continue
        else:
            print(S[i])
            exit()
    print(1)


if __name__ == "__main__":
    main()

Solution (Python):
S = input().strip()
ind = -1
for i in range(len(S)):
    if S[i]=="1":
        ind = i
    else:break
K = int(input())
ind += 1
if K<=ind:
    print(1)
else:
    print(S[ind])

Solution (Python):
import sys

S = sys.stdin.readline().strip()
K = int(sys.stdin.readline())

for s_i in S:
    if s_i == "1":
        K -= 1
    else:
        break
    if K <= 0:
        break
print(s_i)

Solution (Python):
s = list(map(str, input().rstrip()))
k = int(input())

ans = 1
for x in s[:k]:
    if int(x) != 1:
        ans = int(x)
        break
print(ans)

Solution (Python):
S = input()
K = int(input())
OK = True
for i in range(min(K, len(S))):
    if S[i] != '1':
        OK = False
if OK:
    print('1')
    exit()
for i in range(len(S)):
    if S[i] != '1':
        print(S[i])
        exit()

Solution (Python):
S = input()
K = int(input())

i = 0
while i<len(S) and S[i]=='1':
    i += 1

if i >= K:
    print(1)
else:
    print(S[i])

Solution (Python):
s = input()
k = int(input())    



for si in s[:k]:
    sii  = int(si)
    if sii != 1:
        print(sii)
        exit()
else:
    print(1)

Solution (Python):
import sys

sys.setrecursionlimit(10**7)
def I(): return int(sys.stdin.readline().rstrip())
def MI(): return map(int,sys.stdin.readline().rstrip().split())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))  
def LI2(): return list(map(int,sys.stdin.readline().rstrip()))  
def S(): return sys.stdin.readline().rstrip()
def LS(): return list(sys.stdin.readline().rstrip().split())  
def LS2(): return list(sys.stdin.readline().rstrip())  

S = LI2()
K = I()

for i in range(K):
    if S[i] != 1:
        print(S[i])
        exit()
    elif i == K-1 and S[i] == 1:
        print(1)
        exit()

Solution (Python):
S = str(input())
N = int(input())
Ones = 0
nxt = ""
for i in range(len(S)):
  if S[i] == "1":
    Ones += 1
  else:
    nxt = S[i]
    break
if N <= Ones:
  print(1)
else:
  print(nxt)

Solution (Python):
S=input()
K=int(input())
if all(S[i]=="1" for i in range(min(K,len(S)))):
    print(1)
else:
    for i in range(min(K,len(S))):
        if S[i]!="1":
            print(int(S[i]))
            break

Solution (Python):
import sys
s=input()
k=int(input())
for i in range(k):
  if s[i]!='1':
    print(s[i])
    sys.exit()
print(1)

Solution (Python):
S = input()
K = int(input())

cnt_one = 0
for i in S:
    if i == '1':
        cnt_one += 1
    else:
        break

if cnt_one >= K:
    print(1)
else:
    print(S[cnt_one+1-1])

Solution (Python):


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

ans = 1

for i in range(k):
    if s[i] != "1":
        print(s[i])
        exit()

print(ans)

Solution (Python):
S = list(input())
K = int(input())
ans = '1'
for i in range(K):
    if S[i] != '1':
        ans = S[i]
        break
print(ans)

Solution (Python):
S=input()
K=int(input())
S=list(S)

for j in range(len(S)):
    if S[j]=='1':
        if j==K-1:
            ans=1
            break
    else:
        x=[i for i in S if i!='1']
        ans=x[0]
        break

print(ans)

Solution (Python):



from fractions import gcd
from itertools import combinations,permutations,accumulate, product 

from collections import deque,defaultdict,Counter
import decimal
import re
import math












import sys
sys.setrecursionlimit(10000000)


mod = 998244353
def readInts():
  return list(map(int,input().split()))
def I():
  return int(input())



from fractions import gcd
from itertools import combinations,permutations,accumulate, product 

from collections import deque,defaultdict,Counter
import decimal
import re
import math












import sys
sys.setrecursionlimit(10000000)
mod = 10**9 + 7


def readInts():
  return list(map(int,input().split()))
def I():
  return int(input())
s = input()
k = I()
where = 0
while where < len(s):
    if s[where] == '1':
        where += 1
    else:
        break
print('1' if k <= where else s[where])

Solution (Python):
S = list(map(int,input()))
K = int(input())
flag = False
ans = 1
for i in range(K):
  if S[i] != 1:
    flag = True
    ans = S[i]
    break
print(ans)

Solution (Python):
S = input().strip()
K = int(input())
a = "1"
ind = len(S)
for i in range(len(S)):
    if S[i]!="1":
        a = S[i]
        ind = i
        break
if K<=ind:
    print(1)
else:
    print(a)

Solution (Python):
S = input()
K = int(input())
t = -1
for k in range(len(S)):
    t = k
    if S[k] != "1":
        break
if K <= t:
    print(1)
else:
    print(S[t])

Solution (Python):
s = str(input())
k = int(input())

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

if cnt:
    if cnt >= k:
        print('1')
    else:
        print(c)
else:
    print(c)

Solution (Python):
S = list(map(int, input()))
K = int(input())

res = []
for c in S:
    res.append(c)
    if c != 1:
        break
print(res[min(len(res) - 1, K - 1)])

Solution (Python):
s = input()
k = int(input())    
for i in range(k):
    if s[i] != '1':
        print(s[i])
        exit()
else:
    print(1)

Solution (Python):
S = input()
K = int(input())

ones = 0
inf = None
for c in S:
    if c=='1':
        ones += 1
    else:
        inf = c
        break

if K <= ones:
    print('1')
else:
    print(inf)

Solution (Python):
import sys
s=input()
k=int(input())
for i in range(min(len(s),k)):
  if s[i]!='1':
    print(s[i])
    sys.exit()
print(1)

Solution (Python):
s = input()
k = int(input())
cnt = 0
for i in s:
    if int(i) == 1:cnt += 1
    if cnt == k or int(i) != 1:
        print(i)
        break

Solution (Python):
S=input()
K=int(input())
for i in range(K):
	if S[i]!='1':
		print(S[i])
		exit()
print(1)

Solution (Python):
S = list(input())
K = int(input())

ref = 0
for i in range(len(S)):
    if S[i] == "1":
        ref += 1
    else:
        break

ans = ""
if ref == 0:
    ans = S[0]
else:
    if ref >= K:
        ans = "1"
    else:
        ans = S[ref]

print(ans)

Solution (Python):
s=input()
k=int(input())
n=len(s)
for i in range(min(n,k)):
    if s[i]!="1":
        print(s[i])
        exit()
print(1)

Solution (Python):
def number_count(string, n):
    count = 0
    for i in range(len(string)):
        if int(string[i]) == n:
            count += 1
    return count


def main():
    s = str(input())
    k = int(input())

    if number_count(s, 1) == len(s):   
        number = '1'

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

        if k < first_index + 1:
            number = '1'
        else:
            number = s[first_index]


    print(number)


if __name__ == '__main__':
    main()

Solution (Python):

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

c = s.count('1',0,k)

x = s.replace('1', '')

if len(x)==0:
    print(1)
else:
    if c ==k:
        print(1)
    else:
        print(x[0])

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

Solution (Python):
s = list(input())
K = int(input())

i = 0
while(s[i]=='1'):
    K -= 1 
    if K == 0:
        break 
    i += 1 
print(s[i])

Solution (Python):
s=input()
n=len(s)
k=int(input())

index=-1
for i in range(n):
    if s[i]!='1':
        index=i
        break

if index==-1:
    print(1)
else:
    if k<=index:
        print(s[k-1])
    else:
        print(s[index])

Solution (Python):
s = list(input())
k = int(input())
for i in range(min(len(s), k)):
    if s[i] != "1":
        print(s[i])
        exit()
print(1)

Solution (Python):
s = input()
k = int(input())

f = 1
d = 0

for c in s:
    if int(c) != 1:
        f = int(c)
        break
    else:
        d += 1

if d >= k:
    print(1)
else:
    print(f)

Solution (Python):
s = input()
k = int(input())

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)

Solution (Python):
s=list(input())
k=int(input())
num=1
for i in range(len(s)):
  if s[i]!=str(1):
    num=i+1
    break


    
if k>=num:
  print(s[num-1])
else:
  print(1)

Solution (Python):
S=input()
K=int(input())

for i in range(K):
    if S[i]!='1':
        print(int(S[i]))
        break
else:
    print(1)

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

Solution (Python):
S = input()
K = int(input())

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

if ind == -1:
  print(S[0])
elif ind + 1 >= K:
  print(1)
else:
  print(S[ind+1])

Solution (Python):
s = input()
k = int(input())

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

if s[0] == "1":
    if k <= one_counter:
        res = s[0]
    else:
        res = s[one_counter]
else:
    res = s[0]

print(res)

Solution (Python):
S=list(input())
K=int(input())

i=0;p=0;q=0
while i!=len(S):
  if S[i]!="1":
    p=1
    q=i
    if K<i+1:
      print("1")
    else:
      print(S[i])
    break
  i=i+1
if p==0:
  print("1")