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())

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

if pos is None:
    print(1)
elif pos >= K:
    print(1)
else:
    print(ans)

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

sys.setrecursionlimit(10**5)

def li(): return map(int, stdin.readline().split())
def li_(): return map(lambda x: int(x)-1, stdin.readline().split())
def lf(): return map(float, stdin.readline().split())
def ls(): return stdin.readline().split()
def ns(): return stdin.readline().rstrip()
def lc(): return list(ns())
def ni(): return int(stdin.readline())
def nf(): return float(stdin.readline())

s = lc()
k = ni()

not1first_idx = len(s)
not1first = '1'

for i in range(len(s)):
    if s[i] != '1':
        not1first_idx = i
        not1first = s[i]
        break
        
        
if k >= not1first_idx+1:
    print(not1first)
    
else:
    print('1')

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

count = 0
while count < K:
    if S[count] != "1":
        print(S[count])
        break
    count += 1
else:
    print("1")

Solution (Python):
S = list(input())
K = int(input())
flag = 0
i = 0
while i < K: 
  if int(S[i]) == 1:
    flag = 1
    i = i + 1 
  else:
      print(int(S[i]))
      flag = 0
      break
if flag == 1:
  print(1)

Solution (Python):
days = 5000000000000000

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

ss = str(s)
for i in range(len(ss)):
    if ss[i] != "1":
        print(ss[i])
        break
    if k - 1 == i:
        print(1)
        break

Solution (Python):
S = input()
K = int(input())
for i in range(min(len(S), K)):
    if int(S[i]) > 1:
        print(S[i])
        exit()
print(1)

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

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

ans = '1'
pos = 0

while(ans=='1' and pos<K):
  if S[pos] != '1':
    ans = S[pos]
  pos+=1
  
print(ans)

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):

sS = input().rstrip()
iK = int(input())

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

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

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

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

for i in range(len(s)):
    if s[i]=='1' and i<=k-2:
        continue
    elif s[i]=='1' and i==k-1:
        print(1)
        break
    elif s[i]!='1' :
        print(s[i])
        break

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

ans = 1

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

print(ans)

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

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

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

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

Solution (Python):

import sys

import heapq
import re
import bisect
import random
import math
import itertools
from collections import defaultdict, deque
from copy import deepcopy
from decimal import *

n = list(input())
k = int(input())
for i in range(k):
    if n[i] != '1':
        print(n[i])
        sys.exit()
print(1)

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

for i in range(min(K,len(S))):
    if S[i]!='1':
        st=int(S[i])
        break
print(st)

Solution (Python):
from collections import defaultdict, Counter
from itertools import product, groupby, count, permutations, combinations
from math import pi, sqrt
from collections import deque
from bisect import bisect, bisect_left, bisect_right
from string import ascii_lowercase
from functools import lru_cache
import sys
sys.setrecursionlimit(10000)
INF = float("inf")
YES, Yes, yes, NO, No, no = "YES", "Yes", "yes", "NO", "No", "no"
dy4, dx4 = [0, 1, 0, -1], [1, 0, -1, 0]
dy8, dx8 = [0, -1, 0, 1, 1, -1, -1, 1], [1, 0, -1, 0, 1, 1, -1, -1]


def inside(y, x, H, W):
    return 0 <= y < H and 0 <= x < W


def ceil(a, b):
    return (a + b - 1) // b


def main():
    S = input()
    K = int(input())
    if K == 1:
        print(S[0])
        return
    else:
        for i in range(min(len(S), K)):
            if S[i] != "1":
                print(S[i])
                return
    print(1)


if __name__ == '__main__':
    main()

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

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

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

count_1=0
while s!='':
  if s[0]=='1':
    count_1+=1
    s=s[1:]
  else:
    break
if count_1>=k:
  print('1')
else:
  print(s[0])

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

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

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

Solution (Python):
a=input()
b=int(input())
s=0
for x in a:
    if x == "1":
        s += 1
    else :
        c=x
        break
if s >= b :
    print("1")
else:
    print(c)

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


one_idx = -1
next_char = "_"
for i, c in enumerate(S):
    if c == "1":
        one_idx = i
    else:
        next_char = c
        break


if (one_idx >= 0) and (one_idx >= K-1):
    print("1")
else:
    print(next_char)

Solution (Python):
a=input()
b=int(input())
s=0
for x in a:
    if x == "1":
        s += 1
    else :
        c=x
        break
if s >= b :
    print("1")
else:
    print(c)

Solution (Python):
S = input()
K = int(input())
count = 0
for i in range(len(S)):
    Snum = int(S[i])
    if Snum == 1:
        count += 1
        if count >= K:
            break
    else:
        wnum = 1
        for _ in range(K):
            if count + wnum >= K:
                break
            else:
                wnum = wnum*Snum
        else:
            continue
        break

print(str(Snum))

Solution (Python):
import math
s = list(map(int, list(input())))
k = int(input())
for i in range(len(s)):
    n = 5.0e+15 * math.log10(s[i])
    if n >= math.log10(k):
        print(s[i])
        exit()
    else:
        k -= 10**n

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

flag = False
for k in range( min(len(S), K) ):
    if s_list[k] != 1:
        flag = True
        break

if flag:
    print(s_list[k])
else:
    print(1)

Solution (Python):
S = [int(i) for i in input()]
K = int(input())
for s in S:
    if s == 1:
        K -= 1
        if K <= 0:
            print(1)
            break
    else:
        print(s)
        break

Solution (Python):
S = [int(i) for i in input()]
K = int(input())
for s in S:
    if s == 1:
        K -= 1
        if K <= 0:
            print(1)
            break
    else:
        print(s)
        break

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

Solution (Python):
def m():
    s = str(input())
    k = int(input())
    if len(s) >= k:
        for i in s[:k]:
            if i != "1":
                return i
        return 1
    else:
        for i in s:
            if i != "1":
                return i


print(m())

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

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

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

for w in s:
    if w == "1":
        k -= 1
        if k == 0:
            print(1)
            break
    else:
        print(int(w))
        break

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

if K >= len(S):
    K = len(S)

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

if flag:
    print('1')

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

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

if flag:
    print('1')

Solution (Python):
s = input()
k = int(input())
for c in s:
  if c == "1":
    k -= 1
    if k == 0:
      ans = 1
      break
  else:
    ans = c
    break
print(ans)

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

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

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

i=0

while i <= k-1:
	if s[i] == 1:
		ans = 1
		i += 1
	else:
		ans = s[i]
		break

print(ans)

Solution (Python):
import math
S = list(map(int, input()))
K = int(input())
count = 0
after_S = 0
days = 5000000000000000-1
for n in S:
    if n == 1:
        count += 1
    else:
        break
if count > 0 and math.log(count) >= math.log(K):
    print(1)
else:
    for n in S:
        after_S += days * math.log(n)
        if after_S >= math.log(K):
            print(n)
            break

Solution (Python):



if __name__ == "__main__":
    S = list(map(int,list(input())))
    K = int(input())
    if 1 not in S:
        print(S[0])
        exit()
    else:
        for i in range(K):
            if S[i] != 1:
                print(S[i])
                exit()
        print(1)

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

for i, c in enumerate(S):
    if c != "1":
        print(c)
        exit(0)
    if i == K-1:
        print(1)
        exit(0)

Solution (Python):
S=input()
K=int(input())
Slist=list(S)
i=0

while Slist[i]=='1' and K-1!=i:
    i+=1

ans=S[i]
print(ans)

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

t = 0
u = s[0]

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

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

t = 0
u = s[0]

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

Solution (Python):

S=raw_input()
K=int(raw_input())

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

Solution (Python):
s = list(map(int, list(input())))
k = int(input())
nums = 0
for i in s:
    if i > 1:
        print(i)
        break
    else:
        nums += 1
        if nums >= k:
            print(i)
            break

Solution (Python):
import sys

input = sys.stdin.readline
s = input()
k = int(input())
if len(s) == 1:
    print(s)
elif k == 1:
    print(s[0])
else:
    ans = '1'
    for i in range(min(len(s), k)):
        if s[i] != '1':
            ans = s[i]
            break
    print(ans)

Solution (Python):
list_s = list(str(input()))
k = int(input())
bord = 10 **9
for i in range(len(list_s)):
    if list_s[i] != "1":
        bord = i
        break
if k <= bord:
    print(1)
else:
    print(list_s[i])

Solution (Python):

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

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

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

Solution (Python):




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

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

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

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

ans = 1
for si in list(s[:k]):
    if si != "1":
        ans = si
        break
print(ans)

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

if K <= i:
    print(1)
elif i == len(S):
    print(S[i - 1])
else:
    print(S[i])

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

if set(s[:k]) == set('1'):
	print(1)
else:
	for i in s:
		if i != '1':
			print(i)
			exit()

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

sum_=''
for x in S:
    x=int(x)
    K-=1
    if K==0:
        print(x)
        break
    if x !=1:
        print(x)
        break

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

index =0
count =0
while index < len(s):
    spaceForChar = s[index]**50000
    newCount = count+ spaceForChar
    if count < k and k < newCount+1:
        print(s[index])
        break
    index+=1
    count = newCount

Solution (Python):
s = int(input())
l = [int(x) for x in list(str(s))]
k = int(input())
gosencho = 1

if k <= 100:
    for i in range(k):
        if l[i] != 1:
            gosencho = l[i]
            break
else:
    for i in range(len(l)):
        if l[i] != 1:
            gosencho = l[i]
            break

print(gosencho)

Solution (Python):
import sys
import math

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

for _, n in zip(range(K), S):
    if n != "1":
        print(n)
        sys.exit()

print("1")

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

Solution (Python):
inp1 = input()
inp1 = list(inp1)
inp2 = input()
inp2 = int(inp2)

ans = 1
count = 0
for i in inp1:
    if i != '1':
        ans = int(i)
        break
    else:
        count += 1

if count >= inp2:
    ans = 1

print(ans)

Solution (Python):

S=input()
K=int(input())
flag=0
c=0
for i in (S):
    if int(i)!=1:
        print(i)
        flag=1
        break
    else:
        c+=1
        if c>=K:
            print(1)
            flag=1
            break

if flag==0:
    print(1)

Solution (Python):
x=input()
y=input()

for a in x:
    if a!="1" and int(x.index(a))<int(y):
        print(a)
        break
else:
    print(1)

Solution (Python):
x=input()
y=input()
x=list(x)

for a in x:
    if a!="1" and int(x.index(a))<int(y):
        print(a)
        break
else:
    print(1)

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

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

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

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

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


if k <= len(s):
  for i in range(k):
    if not s[i] == '1':
      print(s[i])
      break
  else:
    print(1)
elif k > len(s):
  for i in s:
    if not i == '1':
      print(i)
      break

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

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

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

Solution (Python):
"""
C - To Infinity
"""
s_list = input()
K = int(input())


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

Solution (Python):

s = input()
k = int(input())
idx = 1e+19
for i,char in enumerate(s):
    if int(char)>1:
        x = char
        idx = i
        break

if k>idx:
    print (x)
else:
    print (1)

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


num = []
while n != 0:
  num.append(n % 10)
  n = n//10
num.reverse()


i = 0
while(1):
    if num[i]>1:
        print(num[i])
        break
    else:
        if k==1:
            print(1)
            break
        else:
            k-=1
    i+=1

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

cur = 0
for s in S:
    if s > 1:
        print(s)
        break
    cur += 1
    if cur >= K:
        print(s)
        break

Solution (Python):
S = input()
K = int(input())
cnt = 0
for s in S:
  cnt += 1 if s == '1' else 10 ** 19
  if cnt >= K:
    print(s)
    break

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

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

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

if ans == 1:
    print(ans)
else:
    print(ans)

Solution (Python):
import sys


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

    
    for i in range(0,K):
        if S[i] == '1' and i < K:
            continue
        elif S[i] != '1':
            print(S[i])
            exit()
    print('1')

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

cnt = 0
for s in S:
    if s=="1": cnt+=1
    else: break
if cnt>=K: print(1)
else: print(S[cnt])

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

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

thresh = K
if len(S) < K : thresh = len(S)

isOutput = False
for chr in S[:thresh]:
  if chr != '1':
    print(chr)
    isOutput = True
    break
  
if not isOutput:
  print("1")

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

Solution (Python):
if __name__ == '__main__':
    
    S = str(input())
    K = int(input())
    for n, i in enumerate(S):
        if n+1 == K:
            print(i)
            break
        if i != '1':
            print(i)
            break

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

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

	if s[0:min(k,101)] == "1" * min(k, 101):
		print(1)
	else:
		print(int(s.replace("1", "")[0]))
		

if __name__ == '__main__':
	main()

Solution (Python):


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

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

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

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

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

num = 1
for i in range(1,101):    
	if s[i - 1] != '1':
		num = s[i - 1]
		break
        
	if i == k:
		break
    
print(num)

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

num = 1
for i in range(100):
    if i > k-1 : break

    if s[i] != '1':
        num = s[i]
        break

print(num)

Solution (Python):
s = raw_input()
k = input()
z = 0
ch = ''
for i in s:
	if i == '1':
		z += 1
		continue
	else:
		ch = i
		break
if k <= z:
	print "1"
else:
	print ch

Solution (Python):
def logic(S, K):
    if len(S) == 1:
        return int(S)
    if S[0:int(K)].replace("1","") == "":
        return 1
    a = S.replace("1", "")
    if len(a) == 0:
        return 1
    return int(a[0])


if __name__ == '__main__':
    print(logic(input(), input()))

Solution (Python):
from itertools import dropwhile, islice


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

    c = next(dropwhile(lambda c: c == '1', islice(s, k)), '1')
    print(c)


if __name__ == '__main__':
    main()

Solution (Python):
s = raw_input()
k = raw_input()

f = True
for i, n in enumerate(s):
    if n != "1":
        f = False
        print(n)
        break
    if i+1 == int(k) and f:
        print(1)
        break

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())

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

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

index = 0
while s[index] == "1" and index < len(s) - 1:
    index += 1
if k <= index:
    print('1')
else:
    print(s[index])

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

for i, j in enumerate(s):
    if i + 1 >= k:
        print(j)
        exit()

    if j == "1":
        continue
        
    print(j)
    exit()

Solution (Python):


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

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

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

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

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

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

print(1)

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

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

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

Solution (Python):
s = raw_input()
k = input()
index = -1
for i in xrange(len(s)):
	if s[i] > '1':
		index = i
		break
index += 1
if k >= index:
	print s[index-1]
else:
	print 1

Solution (Python):
S = input()
K = int(input())
s = len(str(S))
i=0

while i < s-1:
  if S[i] == '1':
    i = i + 1
  else:
    break

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

Solution (Python):
s,k = [input() for i in range(2)]
for i in range(int(k)):
    if int(s[i]) > 1:
        print(s[i])
        exit()
print(1)

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

n = 0
for c in S:
  if c != "1": break
  n += 1

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

Solution (Python):
def main(st, k):
	num = 1
	st = str(st)
	for j in range(k):
		if st[j] != '1':
			num = int(st[j])
			break
	
	return num


st = input()
k =int(input())

print(main(st, k))

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

chrs = []
for ch in s:
  if int(ch) in {2,3,4,5,6,7,8,9}:
    chrs.append( (ch, 'Inf') )
  else:
    chrs.append( (ch, None) )





if all(chrs[k2][1] is None for k2 in range(0,k)):
  print(1)
  sys.exit()
ret = None
for chr in chrs:
  if chr[1] == 'Inf':
    ret = chr[0]
    break

print(ret)

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

    if cnt == K:
        print(1)
        break

Solution (Python):
import sys


S = [int(_) for _ in list(input())]
K = int(input())
t = 0
while t <= len(S) - 1:
    if S[t] == 1:
        t += 1
    else:
        break

if K <= t:
    print(1)
    sys.exit()
else:
    print(S[t])
    sys.exit()

Solution (Python):
x=raw_input()
y=input()
n=0
for i in range(len(x)):
    n+=int(x[i])**(5*(10**5))
    if n>=y:
        print x[i] 
        break

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

for i, c in enumerate(S):
    if i >= K:
        print(1)
        quit()
    elif c != '1':
        print(c)
        quit()
print(1)
quit()

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

idx = 101
for s in S:
    if s > 1:
        idx = S.index(s)
        break


if idx == 101:
    ans = S[K - 1]

else:
    
    if K - 1 < idx:
        ans = S[K - 1]
    else:
        ans = s

print(ans)

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

for i,s in enumerate(S):
    if i + 1 == K:
        print(S[i])
        exit()
    if S[i] != "1":
        print(S[i])
        exit()

Solution (Python):
S = list(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:
    for i in range(K):
        if S[i] != '1':
            print(S[i])
            break
        elif S[i] == '1' and i == (K-1):
            print(1)

Solution (Python):
s = input()
k = int(input())
len1 = 0
e = "0"
for c in s:
  if c == "1":
    len1 += 1
  else:
    e = c
    break

if k <= len1:
  print(1)
else:
  print(e)

Solution (Python):
S = input()
K = int(input())
def WhatNum(Str,k):
    if k == 1:
        return Str[0]
    if Str[0] != '1':
        return Str[0]
    else:
        return WhatNum(Str[1:],k-1)
print(WhatNum(S,K))

Solution (Python):
S = input()

K = int(input())

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

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

ones = 0
for st in S:
    if st != '1':
        break
    else:
        ones += 1

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

Solution (Python):
import sys
s = input()
k = int(input())
k = min(k,len(s))
i = 0
f = 0
while i < k:
  if int(s[i]) != 1:
    print(s[i])
    f = 1
    sys.exit()
  i += 1
if f == 0:
  print(1)

Solution (Python):
import sys
s = input()
k = int(input())
k = min(k,len(s))
i = 0
flag = 0
while i < k:
  if int(s[i]) != 1:
    print(s[i])
    flag = 1
    sys.exit()
  i += 1
if flag == 0:
  print(1)

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

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

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

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

if len(s) == 1:
  print(s)
else:
  for c in s:
    if c == "1":
      k -= 1
      if k == 0:
        print("1")
        break
    else:
      print(c)
      break

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

sz = len(s)

for i in range(0, sz):
    if s[i] == '1':
        if i+1 == k:
            print(1)
            break
    else:
        print(s[i])
        break

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

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

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

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

S_list = list(map(int, list(S)))
i = 0
while True:
  if S_list[i] == 1:
    i += 1
    if K == i:
      print(S_list[i-1])
      break
  else:
    if K == 1:
      print(S_list[i])
      break
    else:
      print(S_list[i])
      break

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

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

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

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

left_one_count = 0
first_char_not_one = ""
for c in S:
    if c == "1":
        left_one_count += 1
    else:
        first_char_not_one = c
        break

if left_one_count >= K:
    print("1")
else:
    print(first_char_not_one)

Solution (Python):
def c_to_infinity(S, K):
    ans = '1'
    for s in S[:K]:
        if s != '1':
            ans = s  
            break
    return ans

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

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

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

Solution (Python):

def main9():
    buf = input("");
    buf2 = int(input(""));
    result = 1;
    for i in range(buf2):
        if buf[i] != '1':
            result = int(buf[i]);
            break;
    print(result);


if __name__ == '__main__':
    main9()

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

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

i = 0
while i < k:
	if s[i] != "1":
		break
	i += 1

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

Solution (Python):
def solve(k,s):
    isOne = True
    index = 0
    digit = -1
    while index<len(s):
        if s[index] == "1":
            index += 1
        else:
            digit = s[index]
            break
    if digit != -1:
        if k <= index:
            return(1)
        else:
            return(digit)
    else:
        return(1)

s = input()
k = int(input())
print(solve(k,s))

Solution (Python):
from math import *
s=str(input())
arr=[]
for i in range(len(s)):
    arr.append(int(s[i]))
n=int(input())
val=n
i=0
ans=1
flag=0
while(flag==0):
    ans=ans*arr[i]
    if(s[i]=='1'):
        if(val==1):
            flag=1
            break
        else:
            val-=1
    else:
        if(log(val,ans)<=pow(10,15)*5):
            flag=1
            break
    i+=1
print(arr[i])