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

s = input()
k = int(input())
cur = 0

while cur < k:
    if s[cur] != "1":
        print(s[cur])
        sys.exit()
    cur += 1

print(1)

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

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

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

    if i >= k:
        print(1)
        exit()

    print(s[i])

if __name__ == '__main__':
    main()

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

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

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

answer = S[i]
print(answer)

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[i])

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

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

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

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

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

print(ans)

Solution (Python):
a = input()[:int(input())]
j = set(sorted(set(a), key=a.index)[:2])
j.discard("1")
print(list(j)[0] if j else 1)

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

Solution (Python):
s = str(input())
k = int(input())
flag = False
for i in range(len(s)):
  if s[i] != '1':
    flag = True
    posi = i
    break
if flag:
  if k < posi+1:
    print(1)
  else:
    print(s[posi])
else:
  print(s[0])

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

limit = min(100, k)

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

print(ans)

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

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

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

Solution (Python):
s = input()
k = int(input())
m = 0
for i in s:
  if i=='1':
    m += 1
  else:
    break
if m>=k:
  print(1)
else:
  for i in s:
    if i!="1":
      print(i)
      break
    else:
      continue

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

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

if __name__ == '__main__':
    resolve()

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

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

Solution (Python):


data=input()

k=int(input())

for i,c in enumerate(data):
  if c!='1' or i>=k-1:
    break

print(c)

Solution (Python):

















mod = 10**9 + 7

def readInts():
  return list(map(int,input().split()))
def main():
    s = input()
    k = int(input())
    ichi = 0
    for s_ in s:
        if s_ == '1':
            ichi += 1
        else:
            break
    if ichi >= k:
        print(1)
    else:
        print(s[ichi])
if __name__ == '__main__':
  main()

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

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

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

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

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

Solution (Python):

s = input()
k = int(input())
for si in s:
    if si != '1':
        print(si)
        break
    else:
        k -= 1
        if k == 0:
            print(1)
            break

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

def main():
    S = list(map(int, list(readline().rstrip())))
    K = int(readline())

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

    idx = min(len(S), K)
    if sum(S[:idx]) == len(S[:idx]):
        print(1)
    else:
        for e in S:
            if e != 1:
                print(e)
                return


if __name__ == '__main__':
    main()

Solution (Python):
def myAnswer(S:list,K:int) -> int:
   if(K == 1): return S[0]
   ans = ""
   for n,s in enumerate(S):
      if(s != "1"):
         ans = s
         break
      elif(s == "1" and n == K -1 ):
         ans = "1"
         break
   return ans

def modelAnswer():
   tmp=1
def main():
   S = list(input())
   K = int(input())
   print(myAnswer(S[:],K))

if __name__ == '__main__':
   main()

Solution (Python):
import sys

sys.setrecursionlimit(10 ** 6)


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


S = input()
K = int(input())
if all(c == '1' for c in S[:K]):
    print(1)
else:
    print(list(c for c in S if c != '1')[0])

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

def check(i):
    global k
    global s
    
    if i==k-1:
        print(s[i])
    elif s[i]!="1":
        print(s[i])
    else:
        check(i+1)
check(0)

Solution (Python):
line = input()
N = int(input())
for i in range(len(line)):
  if not line[i] == '1':
    print(line[i])
    break
  elif i+1 == N:
    print("1")
    break

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

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

Solution (Python):
s = input()
k = int(input())
flag = False
for i in range(k):
    if s[i] != '1':
        id = s[i]
        flag = True
        break
if flag:
    print(id)
else:
    print(1)

Solution (Python):
s = str(input())
k = int(input())
ans=0
m=0
for x in s:
  if(int(x)==1):
    m+=1
    continue
  else:
    ans=int(x)
    break

if m<k:
  print(ans)
else:
  print(1)

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

one = 0

for i in S:
    if i != '1':
        c = i
        break
    else:
        one += 1

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

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 = input()
k = int(input())
for i in range(min(k,len(s))):
    if s[i] != "1":
        print(s[i])
        exit()
else:
    print(1)

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

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

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

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

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

print(1)

Solution (Python):
s = input()
k = int(input())
l = len(s)
pos = 0

for i in range(l):
    if s[i] != "1":
        pos = i
        break
if k - 1 < pos:
    print(s[k - 1])
else:
    print(s[pos])

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

Solution (Python):
import sys

s, k = sys.stdin.read().split()
k = int(k)

def main():
    for i in range(min(k, len(s))):
        if s[i] != '1':
            print(s[i])
            return
    print(1)

if __name__ ==  '__main__':
    main()

Solution (Python):





mod = 10**9 + 7

def readInts():
  return list(map(int,input().split()))
def main():
    s = input()
    k = int(input())

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



if __name__ == '__main__':
  main()

Solution (Python):
s = input()
k = int(input())
num = 0
for i in s:
    if i == "1":
        num +=1
        if num == k:
            print(1)
            exit()
    else:
        print(i)
        exit()

Solution (Python):
from itertools import groupby
n = list(input())
k = int(input())
if n == 1:
    print(1)
    exit()
li = []
for key,v in groupby(n):
    li.append(list(v))

if li[0][0] == "1":
    if len(li[0])>= k:
        print(1)
        exit()

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

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):
import math, sys
from bisect import bisect_left, bisect_right
from collections import Counter, defaultdict, deque
from copy import deepcopy
from functools import lru_cache
from heapq import heapify, heappop, heappush
from itertools import accumulate, combinations, permutations
input = sys.stdin.readline
mod = 10**9 + 7
ns = lambda: input().strip()
ni = lambda: int(input().strip())
nm = lambda: map(int, input().split())
nl = lambda: list(map(int, input().split()))

s = ns()
k = ni()
i = 0
while i < len(s):
    if s[i] == '1':
        i += 1
    else:
        ans = int(s[i])
        break

if k <= i:
    ans = 1

print(ans)

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

Solution (Python):
s=input()
n=int(input())
l=[]
for x in s:
    l.append(x)
    if x!="1":break
print(l[min(len(l)-1,n-1)])

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

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

Solution (Python):
import sys
S = input()
K = int(input())
result = [0,""]
for i in S:
  if i != "1":
    result[1] = i
    break
  else:
    result[0] += 1
print(1 if K<=result[0] else result[1] )

Solution (Python):
import sys
def input(): return sys.stdin.readline().rstrip()
def main():
    s=input()
    k=int(input())
    for i in range(min(100,k)):
        if s[i]!='1':
            print(s[i])
            break
    else:print(1)

if __name__=='__main__':
    main()

Solution (Python):
s = input()
k = int(input())
cnt1 = 0
for i in range(k):
    if s[i] == '1':
        cnt1+=1
    else:
        not1ind = i
        break
if cnt1 >= k:
    print(1)
else:
    print(s[not1ind])

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

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

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

sum1 = 0
for i in s:
    if(int(i) == 1):
        sum1 += 1
    else:
        ans = int(i)
        break

if(sum1 >= k):
    print("1")
else:
    print(ans)

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

if s[0] != '1':
    print(s[0])
    exit()
else:
    pos = re.search(r'1+',s).end()
    if k <= pos:
        print(1)
    else:
        print(s[pos])

Solution (Python):
def main():
  from itertools import groupby
  s, n = list(input()), int(input())
  f = False
  for k,v in groupby(s):
    if f:
      print(k)
      break
    if k == '1' and len(list(v)) >= n:
      print(1)
      break
    elif k != '1':
      print(k)
      break
    else:
      f = True

if __name__ == '__main__':
  main()

Solution (Python):
def main():
  s, k = input(), int(input())
  
  count_1 = 0
  tmp = ''
  for l in s:
    if l == '1':
      count_1 += 1
    else:
      tmp = l
      break
  if count_1 < k:
    ans = tmp
  else:
    ans = 1
    
  print(ans)

if __name__ == '__main__':
  main()

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

T = "N"
for i in range(len(S)):
  if S[i] != "1":
    T = "Y"
    k = i+1
    x = int(S[i])
    break
if T == "N":
  print(1)
else:
  if K < k:
    print(1)
  else:
    print(x)

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

Solution (Python):
s = list(str(input()))
k = int(input())
ans = '1'

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

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

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

print(ans)

Solution (Python):
import sys
import os

ii = lambda: int(sys.stdin.buffer.readline().rstrip())
il = lambda: list(map(int, sys.stdin.buffer.readline().split()))
fl = lambda: list(map(float, sys.stdin.buffer.readline().split()))
iln = lambda n: [int(sys.stdin.buffer.readline().rstrip()) for _ in range(n)]

iss = lambda: sys.stdin.buffer.readline().decode().rstrip()
sl = lambda: list(map(str, sys.stdin.buffer.readline().decode().split()))
isn = lambda n: [sys.stdin.buffer.readline().decode().rstrip() for _ in range(n)]

MOD = 10 ** 9 + 7


def main():
    if os.getenv("LOCAL"):
        sys.stdin = open("input.txt", "r")

    S = list(map(int, iss()))
    K = ii()

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


if __name__ == '__main__':
    main()

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

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

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

Solution (Python):


import collections


def solve():

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

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


if __name__ == "__main__":
    solve()

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

i = 0
p = 0
for i in range(len(s)):
    s[i] = int(s[i])
i = 0
while  i < len(s):
    if s[i] == 1:
        p = i + 1
    else:
        q = s[i]
        break
    i = i+1
if K < p + 1:
    print(1)
else:
    print(q)

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

i = 0
p = 0
for i in range(len(s)):
    s[i] = int(s[i])
i = 0
while  i < len(s):
    if s[i] == 1:
        p = i + 1
    else:
        q = s[i]
        break
    i = i+1
if K < p + 1:
    print(1)
else:
    print(q)

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

i = 0
p = 0
for i in range(len(s)):
    s[i] = int(s[i])
i = 0
while  i < len(s):
    if s[i] == 1:
        p = i + 1
    else:
        q = s[i]
        break
    i = i+1
if K < p + 1:
    print(1)
else:
    print(q)

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

i = 0
p = 0
for i in range(len(s)):
    s[i] = int(s[i])
i = 0
while  i < len(s):
    if s[i] == 1:
        p = i + 1
    else:
        q = s[i]
        break
    i = i+1
if K < p + 1:
    print(1)
else:
    print(q)

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

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

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

Solution (Python):


import collections


def solve():

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

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


if __name__ == "__main__":
    solve()

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


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

Solution (Python):

from scipy.sparse.csgraph import shortest_path, floyd_warshall, dijkstra, bellman_ford, johnson, minimum_spanning_tree
from scipy.sparse import csr_matrix, coo_matrix, lil_matrix
import numpy as np
from functools import reduce

from collections import deque, Counter, defaultdict
from itertools import product, permutations,combinations
from operator import itemgetter
from heapq import heappop, heappush
from bisect import bisect_left, bisect_right, bisect
from fractions import gcd
from math import ceil,floor, sqrt, cos, sin, pi, factorial
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10**8)
INF = float('inf')
MOD = 10**9+7

def main():
  n = input()
  k = int(input())
  l = len(n)
  for i in range(min(k,l)):
    if n[i] == '1':
      ans = '1'
    else:
      ans = n[i]
      break
  print(ans)
  
  
  
if __name__ == '__main__':
  main()

Solution (Python):
s=list(input())
k=int(input())
tmp=0
for i in s:
    ans=i
    if ans!="1":
        break
    else:
        tmp+=1
if tmp>=k:
    print("1")
else:
    print(ans)

Solution (Python):


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

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

Solution (Python):
import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, acos, atan, asin, log, log10
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from fractions import gcd
def debug(*args):
    if debugmode:
        print(*args)
def input(): return sys.stdin.readline().strip()
def STR(): return input()
def INT(): return int(input())
def FLOAT(): return float(input())
def MAP(): return map(int, input().split())
def S_MAP(): return map(str, input().split())
def LIST(): return list(map(int, input().split()))
def S_LIST(): return list(map(str, input().split()))
def lcm(a, b): return a * b // gcd(a, b)
sys.setrecursionlimit(10 ** 9)
inf = sys.maxsize
mod = 10 ** 9 + 7
dx = [0, 0, 1, -1, 1, -1, -1, 1]
dy = [1, -1, 0, 0, 1, -1, 1, -1]
debugmode = False



s = STR()
k = INT()
tmp = 0
for i in range(len(s)):
    if s[i] != '1':
        tmp = i
        break
debug(tmp)
if tmp > k - 1:
    print(1)
else:
    print(s[tmp])

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())
cnt = 0
x = 0
for i in s:
    if i == "1":
        cnt += 1
    else:
        x = int(i)
        break
if k<=cnt:
    print(1)
else:
    print(x)

Solution (Python):
s = input()
k = int(input())
for i in range(min(len(s), k)):
  if not s[i] == '1':
    print(s[i])
    break
else:
  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):
S = input().strip()
k = int(input())
for i, c in enumerate(S, 1):
  if c != '1' or i == k:
    break
print(c)

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

Solution (Python):
S = input()
K = int(input())
if S[0] != "1":
    print(S[0])
else:
    ind = 0
    while S[ind] == "1" and ind < len(S) - 1:
        ind += 1
    if ind < K:
        print(S[ind])
    else:
        print("1")

Solution (Python):
a = input()
k = int(input())
count = 1
for i in a:
  if i != "1":
    break
  count += 1
if k >= count:
  print(a[count-1])
else:
  print("1")

Solution (Python):
def To_Infinity(s , k):

    ans = ""

    s1 = s.lstrip("1")

    if k - (len(s) - len(s1)) > 0:
        ans = s1[0]
    else:
        ans = "1"

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

if __name__ == '__main__':
    main()

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

 
for i in range(0,K):
    if S[i] == "1":
        pass
    else:
        print(S[i])
        sys.exit()
print("1")

Solution (Python):
n = input()
k = int(input())
count = 0
flag = True 
while n[count] == '1':
    if count == k - 1:
        print('1')
        flag = False
        break
    count += 1
if flag:
    print(n[count])

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

Solution (Python):
import sys
input = sys.stdin.readline
s = list(input())[:-1]
k = int(input()) 

n = 0
while n < len(s) and n < k:
    if s[n] != '1':
        print(s[n])
        break
    n += 1
else:
    print('1')

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

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

Solution (Python):
def resolve():
    S = input()
    K = int(input())
    cnt = 0
    
    for s in S:
        if s != "1":
            break
        cnt += 1
    if cnt >= K:
        print("1")
    else:
        print(S[cnt])


if '__main__' == __name__:
    resolve()

Solution (Python):


import sys
import math
from bisect import bisect_right as br
from bisect import bisect_left as bl
sys.setrecursionlimit(2147483647)
from heapq import heappush, heappop,heappushpop
from collections import defaultdict
from itertools import accumulate
from collections import Counter
from collections import deque
from operator import itemgetter
from itertools import permutations
mod = 10**9 + 7
inf = float('inf')
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))

s = input()
n = len(s)
k = I()
for i in range(n):
    if s[i] != '1':
        break
else:
    print(1)
    quit()
if k <= i:
    print(1)
else:
    print(s[i])

Solution (Python):
S = list(input())
K = int(input())
for i in S:
    if i != "1":
        break
i = S.index(i)
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":
        continue
    else:
        print(s[i])
        exit()
print(1)

Solution (Python):
S = input()
K = int(input())
if len(S) == 1:
  print(S)  
else:
  if S[:K].count('1') == K:
    print(1)
  else:
    print(list(filter(lambda x: x!= '1', S))[0])

Solution (Python):
a = input()
k = int(input())
b = list(a)
if k == 1:
    print(b[0])
    exit()
else:
    for i in range(k):
        if int(b[i]) != 1:
            print(b[i])
            exit()
print(1)

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

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

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

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

if pt < K:
    print(ans)
else:
    print(1)

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

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

Solution (Python):
5*10**15
S=input()
K=int(input())
if set(list(S[:K]))=={'1'}:
    print('1')
else:
    for i in range(len(S)):
        if S[i]!='1':
            print(S[i])
            break

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

count=0

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

Solution (Python):
s=list(input())
k=int(input())
cnt=0
ans=0
flag=0
for i in s:
    if i =="1":
        cnt+=1
        continue
    else:
        if cnt<k:
            print(i)
        else:
            print("1")
        flag+=1
        break
if flag==0:
    print("1")

Solution (Python):
s = str(input())
k = int(input())
if k <= len(s) and s[:k] == '1' * k:
  ans = 1
else:
  ans = s.replace('1', '')[0]
print(ans)

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

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

for i in list_N:
    i = int(i)
    if i != 1:
        ans = i
        break
    else:
        cnt += 1
        if cnt == k:
            ans = 1
            break

print(ans)

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

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

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

Solution (Python):
S = input()
K = int(input())
if S[0] != '1':
  print(S[0])
  quit()

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

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

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

if k < idx:
    print(1)
else:
    print(res)

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

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

    all1flg = True
    for i in range(min(len(S), K-1)):
        if S[i]!='1':
            ans = S[i]
            all1flg = False
            break
    if all1flg:
        print(S[K-1])
    else:
        print(ans)

if __name__ == '__main__':
    resolve()

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

for i in range(len(S)):
  si=int(S[i])
  if si>1:
    print(si)
    break
  elif i==K-1:
    print(si)
    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 = input()
k = int(input())
flag = False
 
for i in range(min(len(s), k)):
    if s[i] != '1':
        ans = int(s[i])
        flag = True
        break
if flag == True:
    print(ans)
else:
    print(1)

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

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

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

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

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

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

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

Solution (Python):



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


def main():
    n = 1
    for s in S:
        if s != '1':
            print(int(s))
            return
        if n == K:
            print(1)
            return
        n += 1


if __name__ == "__main__":
    main()

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

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

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

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

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