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):
S=input()
K=int(input())
for i in range(len(S)):
    if (int(S[i])!=1):
        print(S[i])
        break;
    elif (i+1==K):
        print(1)
        break;

Solution (Python):
import sys,collections,math;sys.setrecursionlimit(10**7)
def Is(): return [int(x) for x in sys.stdin.readline().split()]
def Ss(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def S(): return input()

s = S()
k = I()
ans = 0
for i in range(k):
    if int(s[i]) == 1:
        continue
    else:
        ans = i
        break
print(s[ans])

Solution (Python):
import numpy as np
def get():
    s = input()
    k = int(input())
    nums = []
    for item in s:
        nums.append(int(item))
    nums = np.array(nums)
    
    
    
    
    
    for i in nums[:k]:
        if i!=1:
            return i
    return 1
a = get()
print(a)

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

if k == '1':
    print(s[0])
else:
    n = min(int(k), len(s))
    f = True
    for i in range(n):
        if s[i] != '1':
            print(s[i])
            f = False
            break
    if f:
        print(1)

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

i = 0
ans = '0'
while True:
    try:
        if s[i] != '1':
            ans = s[i]
            break
        else:
            i += 1
    except IndexError:
        ans = s[i-1]
        break
    
if k <= len(s):
    ans = '1'
    for i in range(k):
        if s[i] != '1':
            ans = s[i]
            break

print(ans)

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

numlist = list(map(int, list(S)))
count = 0
for i in range(len(numlist)):
    if numlist[i] != 1:
        count = i + 1
        break

if count > K:
    print(1)
else:
    print(numlist[count - 1])

Solution (Python):
S = input().strip()
K = input().strip()

if len(K) <= 3:
    k = int(K)
else:
    k = 1000

if len(S) == 1:
    print(S)
elif len(S) == sum([int(i) for i in S]):
    print(1)
else:
    for i in S:
        k -= 1
        if (k == 0) or (i != "1"):
            print(i)
            break

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

if len(S) >= K :
    T = S[0:K]
else :
    T = S[0:len(S)]
point = T.count("1")
if point >= K :
    print(1)
else :
    for j in range(len(S)) :
        if S[j] != "1" :
            print(S[j])
            break

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

s = ''
for i in S:
    s += i
    if i != '1':
        break

if K < len(s):
    print(s[K-1])
else:
    print(s[-1])

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

ans = ''
i = 0
while True:
    if k == 1:
       ans = s[i]
       break
    else:
        if s[i] == '1':
            k -= 1
            i += 1
        else:
           ans = s[i]
           break
print(ans)

Solution (Python):
import numpy as np
S = raw_input()
K = input()
DAYS = 60
sum_count_list = []
for i in range(len(S)):
	sc = 0
	if len(sum_count_list) > 0:
		sc = sum_count_list[-1]
	sc += int(S[i]) ** DAYS
	sum_count_list.append(sc)
	
for i in range(len(S)):
	if K <= sum_count_list[i]:
		print(S[i])
		break

Solution (Python):
a = list(map(int,input()))

b = int(input())

k = 0

if len(a) == 1:
    print(a[0])

else:
    for i in range(len(a)):
        if a[i] == 1:
            k += 1
        else:
            k = a[i]
            break
        if k == b:
            k = 1
            break
    print(k)

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

count=0
for i in a:
    if i=="1":
        count+=1
    elif i != "1":
        break

for i in a:
    if count >= k:
        print("1")
        break
    if i!="1":
        print(i)
        break

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

if S[0]=="1":
	for i in range(K):
		if S[i]!="1":
			print S[i]
			quit()
	else:
		print 1
		quit()
	
else:
	print S[0]

Solution (Python):
s=input()
k=int(input())
atai = [0 for i in range(len(s))]
atai2 = [0 for i in range(len(s))]
kazu = [0 for i in range(len(s))]

gosen_chou = 5000 * 10 ** 12

for i in range(len(s)):
  atai[i] = int(s[i])

ans2 = -1
count = 0
for i in range(len(s)):
  if atai[i] ==1:
    count +=1
  elif atai[i] != 1:
    ans2 = atai[i]
    break    

if k <= count:
  print(1)
else:
  print(ans2)
    
    
"""
for i in range(len(s)):
  atai2[i] = atai[i] ** gosen_chou

a = 0  
for i in range(len(s)):
  a += atai2[i]
  kazu[i] = a

for i in range(len(s)):
  if k <= kazu[i]:
    ans = atai[i]
    break
    
  
print(atai)
print(kazu)
"""

Solution (Python):
A=input()
B=int(input())

for i in A:
    if int(i) == 1:
        B-=1
    else:
        print(int(i))
        exit(0)
    if B == 0:
        print(1)
        exit(0)

Solution (Python):
from sys import exit, setrecursionlimit, stderr
from functools import reduce
from itertools import *
from collections import defaultdict
from bisect import bisect

def read():
  return int(input())

def reads():
  return [int(x) for x in input().split()]

def test(x):
  return x % 2 == 1 and sum(x % y == 0 for y in range(1, x+1)) == 8

S = input()
K = read() - 1
N = len(S)
i0 = next((i for i in range(N) if S[i] != '1'), N)
if K < i0:
  print(1)
else:
  print(S[i0])

Solution (Python):


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

    for elm in S:
        if elm != '1':
            ctr = S.index(elm)
            break
    else:
        ctr = -1

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

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

Solution (Python):
s = list(input())
k = int(input())
if '1' not in s:
    print(s[0])
else:
    num = 0
    for i in range(len(s)):
        if s[0] == "1":
            s.pop(0)
            num += 1
        else:
            break
    if num >= k:
        print(1)
    else:
        print(s[0])

Solution (Python):

import math,string,itertools,fractions,heapq,collections,re,array,bisect

def s():
    return input()
def n():
    return int(input())

S = s()
K = n()

n=0
for s in S:
    n += 1
    if s != '1':
        s_first = s
        break

if n <= K:
    print(s)
else:
    print(1)

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




ar = []

for i in S:
    ar.append(int(i))








for i in range(len(ar)):
    if ar[i] == 1:
        if i + 1 == K:
            print(1)
            break
    else:
        print(ar[i])
        break

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

count = 0
answer =''
for s in S:
    if s == '1':
        count += 1
    else:
        answer = s
        break
if count >= K:
    print('1')
else:
    print(answer)

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

i=0
while(s[i]=="1"):
    if i==(len(s)-1):
        break
    i +=1
    
if k<(i+1):
    print(1)
else:
    print(s[i])

Solution (Python):
S = input()
K = int(input())
for s in list(S):
  ans = s
  if s=='1':
    K = K-1
  else:
    break
  if K==0:
    break
print(ans)

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

for i,c in enumerate(S,1):
        if c == "1" and i != K:
                continue
        else:
                print(c)
                break
else:
        print("1")

Solution (Python):
s = list(input())
k = int(input())
i = 0
flag = 0
while s[i] == "1":
    i += 1
    if i == len(s):
        flag = 1
        break
onelength = i
if flag == 1:
    print(1)
else :
    onenext = s[i]
    if onelength < k:
        print(s[i])
    else:
        print(1)

Solution (Python):
n=input()
m=int(input())
s=list(n)
if s[0]!="1":
    print(s[0])
elif s[0]=="1":
    p=0
    for i in s:
        if i=="1":
            p+=1
        else:
            q=i
            break
    if m<=p:
        print(1)
    else:
        print(q)

Solution (Python):
import sys
stdin = sys.stdin
ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline().rstrip()

S=ni()
K=ni()
S=str(S)

count_one=0
ans_tmp=1
for i in range(len(S)):
  if S[i]=='1':
    count_one+=1
  else:
    ans=S[i]
    break

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

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

Solution (Python):
def run(s, k):
    cnt = 0
    for si in s:
        si = int(si)
        if si == 1:
            cnt += 1
        else:
            return si
        if k == cnt:
            return 1


def read_line():
    s = input()
    k = int(input())
    return (s, k)


def main():
    s, k = read_line()
    print(run(s, k))


if __name__ == '__main__':
    main()

Solution (Python):
from sys import stdin



def main():
    S = stdin.readline().rstrip()
    K = int(stdin.readline().rstrip())
    tmp = 0
    
    for c in S:
        if c == '1':
            tmp += 1
            if K == tmp:
                print(1)
                break
        else:
            print(c)
            break


if __name__ == '__main__':
    main()

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

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

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

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

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

if n >= k:
	n = k

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

if flag == -1:
	print('1')
else:
	print(s[flag])

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




ch_cnt = 0
first_num = 1

for ch in s:
    if ch != "1":
        first_num = int(ch)
        break
    ch_cnt += 1



if k <= ch_cnt:
    print(1)
else:
    print(first_num)

Solution (Python):
s = input()
k = int(input())
for i, c in enumerate(s):
    if i + 1 == k or c != '1':
        print(c)
        break

Solution (Python):




def solve():
    s = input()
    n = int(input())
    idx = 0
    slen = len(s)
    while idx < slen and s[idx] == "1":
        idx += 1
        if idx == n:
            print(1)
            return
    if idx == slen:
        print(1)
    else:
        print(s[idx])


if __name__ == "__main__":
    solve()

Solution (Python):
S = input()
K = int(input())
key = 0
i = 0
while True:
    if i >= K:
        break
    if i >= len(S):
        break
    if int(S[i]) != 1:
        print(S[i])
        key = 1
        break
    i += 1

if key == 0:
    print(S[0])

Solution (Python):


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

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

        moji = s[i]
        break
    else:
        if i+1 == k:
            moji = "1"

print(moji)

Solution (Python):
S = [int(x) for x in list(input())]
K = int(input())
flag = True; i = 0
while flag:
    if S[i] == 1:
        if K == 1:
            print(1)
            flag = False
        else:
            i += 1
            K -= 1
    else:
        print(S[i])
        flag = False

Solution (Python):
s = input()
k = int(input())
n = len(s)
index = float("inf")
num = 0
for i in range(n):
    if s[i] != "1":
        index = i + 1
        num = s[i]
        break

if k < index:
    print(1)
else:
    print(num)

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

for i in S:
    if(i=="1"):
        if(K==1):
            print("1");
            break;
        else:
            K-=1;
    else:
        print(i);
        break;

Solution (Python):
import sys


def main(S, K):
    
    
    

    one = 0 
    for d in S:
        if d == '1':
            one += 1
        else:
            c = d
            break
    print("one", one, file=sys.stderr)
    if one != 0 and K <= one:
        return '1'
    else:
        return d

if len(sys.argv) == 3:
    S = sys.argv[1]
    K = int(sys.argv[2])
    print(main(S, K))
else:
    S = input()
    K = int(input())
    print(main(S, K))

Solution (Python):


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

days = 5000000000000000
strNum = 0
calcEnd = False
for i in S:
    i_int = int(i)
    iNum = 1
    
    if i_int == 1:
        iNum == 1
        if strNum + iNum >= K:
            ans = i
            calcEnd = True
            break

    else:
        for j in range(days):
            iNum *= i_int

            if strNum + iNum >= K:
                ans = i
                calcEnd = True
                break

    strNum += iNum

    if calcEnd == True:
        break

print(ans)

Solution (Python):
s=input()
k=int(input())
n=0
for i in s:
    if int(i)==1:n+=1
    else:break
print(s[n] if n<k else 1)

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


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


if len(S)==1:
    ans=S[0]

elif n<=onecount:
    ans=1
else:
    ans=S[onecount]
    
print(ans)

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

for c in s[:min(len(s),k)]:
    if c != '1':
        print(c)
        exit()
print('1')

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

ar = [int(s) for s in st]

count = 0
for a in ar:
    if a==1:
        count+=1
    else:
        break

if k<=count:
    print(1)
else:
    print(ar[count])

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

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

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

if S[x]=="1":
    print(1)

elif K<x+1:
    print(1)

else:
    print(S[x])

Solution (Python):
import sys

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


i=0
while i<len(s) and i<k:
    if s[i]=="1":
        i+=1
    else:
        print(s[i])
        sys.exit()
print("1")

Solution (Python):
def c_to_infinity(S, K):
    for k, s in enumerate(S,1):
        if s != '1':
            if k > K:
                return '1'
            else:
                return s
    
    return 1

S = input().strip()
K = int(input())
print(c_to_infinity(S, K))

Solution (Python):

from collections import Counter

def main():
    s = list(map(int, list(input())))
    k = int(input())

    counter = Counter(s[:k])
    if counter[1] == k:
        print(1)
        exit()
    for i in s:
        if i != 1:
            print(i)
            break

if __name__ == '__main__':
    main()

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

i = 0
while(i<k-1):
    if s[i] != '1':
        break
    else:
        i+=1
        
print(s[i])

Solution (Python):
S = input()
K = int(input())
g = 5 * 10**15
if S[0] == '1':
    for i, s in enumerate(S):
        if s != '1':
            break
    if i >= K:
        print(1)
    else:
        print(S[i])
else:
    print(S[0])

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

if s[0]!="1":
  print(s[0])
else:
  cnt=1
  for j in range(len(s)):
    if s[j]!="1":
      break
    else:
      cnt+=1
  if cnt==1 or n < cnt:
    print(1)
  else:
    print(s[cnt-1])

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=list(input())
k= int(input())
flag=True
cnt=0
for i in range(k):
    if s[i]!='1':
        flag=False
        cnt=i
        break
if flag:
    print('1')
else:
    print(s[cnt])

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

Solution (Python):

a=input()
b=input()

sum=0
for i in range(len(a)):
     if a[i]=='1':
         sum=sum+1
     else:
         temp=a[i]
         break
if(int(b)<=sum):
    print(1)
else:
    print(temp)

Solution (Python):
S = input()
K = int(input())
tmp = None
for i,j in enumerate(S):
    if not j == "1":
        tmp = i+1
        break
if tmp == None:
    print("1")
elif K < tmp:
    print("1")
else:
    print(j)

Solution (Python):
S=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())
a = 0
b = ''
for i, j in enumerate(s):
    if j != '1':
        a = i
        b = j
        break
else:
    a = len(s)

if K <= a:
    print(1)
else:
    print(b)

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

a = 0
while s[a] == '1':
    a += 1
    if a >= len(s):
        break

if k <= a:
    print('1')
else:
    if a >= len(s):
        print('1')
    else:
        print(s[a])

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

i=0
while(1):
    if(int(s[i])>1):
        print(s[i])
        break
    if(i == k-1):
        print("1")
        break
    i += 1

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

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

if k > m:
    print(s[m])
else:
    print('1')

Solution (Python):
s = input()
k = int(input())
idx = 0
while idx < len(s) and s[idx] == '1':
    idx += 1
if k <= idx or idx == len(s):
    print(1)
else:
    print(s[idx])

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

count = 0
for i in s:
    if int(i) == 1:
        count+=1
        if count == k:
            print(i)
            break
    else:
        print(i)
        break

Solution (Python):
ss=input()
kk=int(input())

def c(s,k):
    for i in range(len(ss)):
        if int(s[i])==1:
            k-=1
            if k==0:
                return int(s[i])
        else:
            return int(s[i])
    return 0

print(c(ss,kk))

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

for i,s in enumerate(S):
    if s != '1': break
        
if K<=i: print(1)
else: print(S[i])

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

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

T = ''
for s in S:
    T += s
    if s != '1':
        break

if K >= len(T):
    print(T[-1])
else:
    print(1)

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



length_1 = 0
for i in range(len(S)):
    if S[i] == '1':
        length_1 += 1
    else:
        break
if K <= length_1:
    print(1)
else:
    print(S[length_1])

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



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

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

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

def solve():
    count = 1
    for si in S:
        if si == "1":
            if count == K:
                print(si)
                break
            count += 1
        else:
            print(si)
            break

solve()

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

Solution (Python):
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 = list(map(int, list(input())))
k = int(input())
res = False
for i, e in enumerate(s):
    if e == 1:
        if i + 1 == k:
            print(1)
            break
    else:
        res = True
        print(e)
        break

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

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

Solution (Python):
import numpy as np
import math

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

k = 0

while k < len(S) and S[k] == '1' and k < K:
    k += 1

if k == K or k == len(S):
    print('1')
else:
    print(S[k])

Solution (Python):


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

digits = 0

res = ""
for c in s:
    if int(c) == 1:
        digits += 1
        if digits == k:
            res = 1
            break
    else:
        res = int(c)
        break
    
print(res)

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

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

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

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

head1num = 0
while S[head1num] == '1':
  head1num += 1

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

Solution (Python):
S=str(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 = map(int,list(raw_input()))

k = int(input())

t = -1

for i in range(len(s)):
	if s[i] == 1:
		t = i

	else :
		break

if t > -1 and k-1 <= t:
	print 1

else :
	print s[t+1]

Solution (Python):
S=str(input())
cnt=0
num=0
for i in range(len(S)):
    if S[i]=="1":
        cnt+=1
    else:
        num=S[i]
        break

K=int(input())
if K<=cnt:
    print("1")
elif K>cnt:
    print(num)

Solution (Python):
s = input()
k = int(input())
a = 0
for i in s:
    if i == '1':
        a += 1
    else:
        break
if k <= a:
    print(1)
else:
    for i in s:
        if i != '1':
            print(i)
            break

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

    for c in s:
        k -= 1
        if k == 0:
            print(c)
            return
        if c != "1":
            print(c)
            return


if __name__ == '__main__':
    main()

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):
n=int(input())
k=int(input())

ans=[]

while n>0:
    ans.append(n%10)
    n=n//10
    
ans.reverse()

c = 0

for i in range(len(ans)):
    if ans[i]==1:
        c+=1
    else:
        a=ans[i]
        break

if c>=k:
    print(1)
else:
    print(a)

Solution (Python):
def i1():
 return int(input())
def i2():
 return [int(i) for i in input().split()]
s=input()
k=i1()
x=[-1,-1]
for i in range(len(s)):
 if s[i]!='1':
    x=[i,s[i]]
    break
if x[0]>=0 and k>=x[0]+1:
   print(x[1])
else:
   print(1)

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

S2 = ""
for i in range(len(S)):
    if S[i]=="1":
        S2 += "1"
    else:
        S2 += S[i]*101
        break

if K<100:
    print(S2[K-1])
else:
    print(S2[100])

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

for s in S:
    if s == '1':
        r += 1
        if K <= r:
            print(s)
            break
    else:
        print(s)
        break

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

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

S = list(map(int,list(S)))

for i in S:
    K -= i
    if i!=1 or K <= 0:
        print(i)
        break

Solution (Python):

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

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

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

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

idx = -1
for i in range(len(s)):
    if s[i] != '1':
        break
    idx = i
idx += 1

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

Solution (Python):
S = input()
K = int(input())
day = 5 * pow(10, 15)


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

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




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

if k <= not1:
    print(1)
else:
    print(first_not1)

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

for i, si in enumerate(s):
    if si != '1':
        ind = i
        res = si
        break
    if i == len(s) - 1:
        res = 'one'

if res == 'one':
    print(1)
elif ind >= k:
    print(1)
else:
    print(res)

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

def oneWhenEnd(s) : 
    count = 0
    for c in s : 
        if c != "1" : 
            return count
        count += 1
    return count
    
def getChar(s) : 
    for c in s : 
        if c != "1" : 
            return c
            
def f(s , k) : 
    x = oneWhenEnd(s)
    if x == 0 :
        return getChar(s)
    elif x == len(s) : 
        return 1
    else : 
        if k > x : 
            return getChar(s)
        else : 
            return 1

print(f(s , k) )

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

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

print(1 if ones >= K else n)

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

cnt = 0

for s in S:
    if int(s) != 1:
        print(s)
        exit()
    cnt += 1
    if cnt == k:
        break

print(1)

Solution (Python):

import bisect
import heapq
import math
import random
import sys
from collections import Counter, defaultdict, deque
from decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal
from functools import lru_cache, reduce
from itertools import combinations, combinations_with_replacement, product, permutations
from operator import add, mul, sub

sys.setrecursionlimit(10000)


def read_int():
    return int(input())


def read_int_n():
    return list(map(int, input().split()))


def read_float():
    return float(input())


def read_float_n():
    return list(map(float, input().split()))


def read_str():
    return input().strip()


def read_str_n():
    return list(map(str, input().split()))


def error_print(*args):
    print(*args, file=sys.stderr)


def mt(f):
    import time

    def wrap(*args, **kwargs):
        s = time.time()
        ret = f(*args, **kwargs)
        e = time.time()

        error_print(e - s, 'sec')
        return ret

    return wrap


@mt
def slv(S, K):
    if K <= len(S) and S[:K].count('1') == K:
        return 1

    for c in S:
        if c != '1':
            return c


def main():
    S = read_str()
    K = read_int()
    print(slv(S, K))


if __name__ == '__main__':
    main()

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

    if s[:k].replace("1", "") == "":
        return 1
    else:
        return (s.replace("1", ""))[0]


print(abc106_c())

Solution (Python):
s = input()
k = int(input()) - 1
for i, c in enumerate(s):
    if i == k:
        print(c)
        break
    if c != '1':
        print(c)
        break

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

num = 0
for i in s:
    if i == "1":
        num += 1
    else:
        break

first = 0
for i in s:
    if i == "1":
        first = 1
    else:
        first = i
        break

if num == 0:
    print(first)
elif k <= num:
    print(1)
else:
    print(first)

Solution (Python):
s = input()
k = int(input())
if len(s) == 1:
    print(s)
elif k == 1:
    print(s[0])
else:
    flag = 0
    for i in range(min(len(s), k)):
        if s[i] == '1':
            pass
        else:
            flag = 1
            print(s[i])
            break
    if flag == 0:
        print('1')

Solution (Python):
import sys
from collections import deque
import copy
import heapq

from math import *

def get_read_func(fileobject):
    if fileobject == None :
        return raw_input
    else:
        return fileobject.readline

def main():
    if len(sys.argv) > 1:
        f = open(sys.argv[1])
    else:
        f = None
    read_func = get_read_func(f);
    input_raw = read_func().strip().split()
    [S] =  [(input_raw[0])]
    input_raw = read_func().strip().split()
    [K] = [long(input_raw[0])]
    count = 0L;
    for s in S:
        if s != "1":
            break;
        count += 1
    if count >= K:
        print S[K-1]
    else:
        print S[count]

if __name__ == '__main__':
    main()

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

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

if check:
    print('1')

Solution (Python):
S=input()
K=int(input())
f=True
count=0
for i in range(len(S)):
    if f :
        if S[i]=='1':
            count+=1
        else:
            num=S[i]
            f=False
if(count>=K):
    print(1)
else :
    print(num)

Solution (Python):

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

idx = len(S)

for i in range(len(S)):
    if S[i] != "1":
        idx = i
        res_inf = int(S[i])
        break
if K <= idx:
    print(1)
else:
    print(res_inf)

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

Solution (Python):

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



ret = ""
for i,x in enumerate(s):
    
    if x!="1":
        print(x)
        exit()
    elif i+1==k:
        print(1)
        exit()
print(1)

Solution (Python):
S = input()
K = int(input())
if K <= 100:
    if all([s == "1" for s in S[:K]]):
        print(1)
        exit()
print(S.replace("1", "")[0])

Solution (Python):
S = input()
N = int(input())
count = 0
for i in range(len(S)):
  if S[i] != '1':
    if count < N:
      print(S[i])
    else:
      print('1')
    exit()
  else:
    count += 1
print('1')

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

k = 0
for s in S:
  if s == '1':
    k += 1
  else:
    break

if K - k <= 0:
  print(1)
else:
  print(S[k])