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())
cnt = 0
for i in range(len(s)):
    if s[i] == "1":
        cnt += 1
    else:
        tail = s[i]
        break
if k > cnt:
    print(tail)
else:
    print("1")

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

Solution (Python):
a=input()
k=int(input())
count=0
for i in a:
    if i=='1':count+=1
    else:break
if count>=k:print(1)
else:print(a.replace('1','')[0])

Solution (Python):
s=input()
k=int(input())
for i,num in enumerate(s):
    num=int(num)
    if num ==1:
        if i != k-1:
            continue
        print(1)
        break
    print(num)
    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):
numl=list(input())
k=int(input())
rs=0
for i in range(k):
    if not numl[i]=="1":
        print(int(numl[i]))
        rs=0
        break
    else:
        rs=1
if rs==1:
    print(1)

Solution (Python):

import sys

s=raw_input()
k=int(raw_input())
if s.count('1')==len(s):
 print '1'
 sys.exit()
for i in xrange(k):
 if s[i]!='1':
  print s[i]
  sys.exit()
print '1'

Solution (Python):
import math
S = input()
K = int(input())
M = 5 * 10 ** 15

def main():
    sum = 0
    for s in S:
        n = int(s)
        sum += (M - 1) * math.log(n)
        if sum >= math.log(K):
            print(n)
            return

def main2():
    if K <= len(S):
        for i in range(K):
            if S[i] != '1':
                print(S[i])
                return
        print('1')
        return
    else:
        for s in S:
            if s != '1':
                print(s)
                return

if __name__ == '__main__':
    main2()

Solution (Python):

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

slist = list(s)
i = 0
count = 0
while slist[i] == "1":
    count += 1
    i += 1
    if i >= len(slist):
        break
    
if count >= k:
    print(1)
else:
    print(slist[i])

Solution (Python):


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

def prefixlen(s, c):
    """文字列sの文字cのみからなる接頭辞の長さ"""
    count = 0
    for x in s:
        if x != c: break
        count += 1
    return count

l = prefixlen(S, '1')
print(S[l] if l < K else '1')

Solution (Python):
count = 0

s_chars = input()
k_num = int(input())

for i in s_chars:
    if i == '1':
        count += 1
    else:
        break

if s_chars[0] != '1':
    print(s_chars[0])
else:
    if count >= k_num:
        print(s_chars[k_num - 1])
    else:
        print(s_chars[count])

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

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

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

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

Solution (Python):
s=input()
if len(s)<2:
  print(s)
  exit()
k=int(input())
for t in s[:k]:
  if t!='1':
    print(t)
    break
else:
  print(1)

Solution (Python):
s=input()
if len(s)<2:
  print(s)
  exit()
k=int(input())
for t in s[:k]:
  if t!='1':
    print(t)
    break
else:
  print(1)

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

Solution (Python):
s=input()
k=int(input())
count=0
for one in s:
  if one=="1":
    count+=1
  else:
    break
print(int(s.replace("1","")[0]) if k>count else 1)

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


def ans():
    if len(S) == 1:
        return S
    else:
        for i in range(len(S)):
            if i + 1 == k:
                return S[i]
            if S[i] != '1':
                return S[i]

    return 1


print(ans())

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

Solution (Python):



def main():
    s = input()
    target_index = int(input()) - 1

    for char in s[:target_index + 1]:
        if char == '1':
            continue
        else:
            print(char)
            return

    print('1')


if __name__ == '__main__':
    main()

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

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

print ans

Solution (Python):
def main():
    S = input()
    K = int(input())
    output = solve(S, K)
    print(output)
    return

def solve(S, K):
    """
    解答のコード
    """
    for i in range(K):
        if S[i] != "1":
            return S[i]
    return "1"

if __name__ == "__main__":
    main()

Solution (Python):
def main():
    S = input()
    K = int(input())
    output = solve(S, K)
    print(output)
    return

def solve(S, K):
    if K <= len(S) and S[:K] == "1"*K:
        
        
        return "1"
    for s in S:
        if not s == "1":
            return s  
if __name__ == "__main__":
    main()

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):
s = input()
k = int(input())
ans = 0

sum_num = 0
for i in range(len(s)):
    num = int(s[i])
    if num == 1:
        sum_num += 1
        if sum_num >= k:
            ans = 1
            break
    else:
        ans = num
        break

print(ans)

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

ans = 1

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

print(ans)

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




ans = 1
ones = -1

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

if ones == -1:
    ones = len(S) + 1

if K <= ones:
    ans = 1

print(ans)

Solution (Python):
def main():
    s = input()
    k = int(input()) - 1
    n = len(s)
    for i in range(n):
        if k == 0 or s[i] != '1':
            print(s[i])
            return
        k -= 1

main()

Solution (Python):


s,k = [ input() for i in range(2) ]

count = 0
while count != len(s) and s[count]=="1":
    count += 1

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

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

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

while s[0] == "1" and len(s) >= 2:
    del s[0]
    o += 1

if o >= k:
    print("1")
else:
    print(s[0])

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

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

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

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

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

Solution (Python):

S = input()
K = int(input())
counter = 0
for i in S:
    if i == '1':
        counter += 1
    else:
        break
if K <= counter:
    print(1)
else:
    print(S[counter])

Solution (Python):
s = list(map(int, list(input())))
k = int(input())
total = 0
for i in range(len(s)):
    total += pow(s[i], 5000)
    if total >= k:
        print(s[i])
        break

Solution (Python):

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


tmp = 1
for i in range(5000 * (10 ** 12)):
    tmp = tmp << 1
    if tmp > K:
        for idx, si in enumerate(S):
            if si != "1": break
        
        if K <= idx: print(1)
        else: print(si)
        
        break
else:
    
    print("WA")

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=str(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):


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

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

Solution (Python):
s = input()
k = int(input())
n = 5*(10**15)
for x in s:
    if x=='1':
      k -= 1
      if k==0:
      	print(1)
      	break
    else:
      print(x)
      break

Solution (Python):
S = list(map(int,input()))
K = int(input())
ans = 1
if K == 1 or S.count(S[0]) == len(S) or S.count(1) == len(S):
    ans = S[0]
else:
  for x in range(K):
    if S[x] != 1:
      ans = S[x]
      break
print(ans)

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

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

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




length_1 = len(S)
K = int(K)

i =int(S)
v_1 = []

while i > 0:
    v_1.append( i % 10 )
    
    i //= 10 
v_1.reverse()

length_n = 0
target_v_num = 0

while length_n < K:
    V = v_1[target_v_num]
    length_n = length_n + 1
    if V > 1:
        length_n = length_n + K
    target_v_num = target_v_num + 1


print(V)

Solution (Python):


def getLoop(S, K):
    if len(S) > K:
        return K
    if len(S) <= K:
        return len(S)

def solve(S, K):
    SList = [int(x) for x in S]
    for i in range(getLoop(S, K)):
        if SList[i] != 1:
            return SList[i]
    return 1
    
if __name__ == "__main__":
    S = input()
    K = int(input())
    print(solve(S, K))

Solution (Python):
s = raw_input()
k = input()
for i in range(len(s)):
    if i == k - 1 or s[i] != "1":
        print s[i]
        exit()

Solution (Python):
s=input()
k=int(input())
con1=0
ans=0
for c in s:
    if c!='1':
        ans=int(c)
        break
    con1+=1
else:
    ans=1
if k==1:
    ans=int(s[0])
if k<=con1:
    ans=1
print(ans)

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

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

print(tmp)

Solution (Python):
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,copy,functools

sys.setrecursionlimit(10**7)
inf = 10**20
eps = 1.0 / 10**10
mod = 10**9+7
dd = [(-1,0),(0,1),(1,0),(0,-1)]
ddn = [(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()
def pf(s): return print(s, flush=True)


def main():
    s = S()
    k = I()
    l = 0
    for c in s:
        if c != '1':
            break
        l += 1
    if l >= k:
        return 1
    return s[l]



print(main())

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

ans = 1
i = 0

while i < k and i < len(s):
    if s[i] != '1':
        ans = s[i]
        break
    i += 1

print(ans)

Solution (Python):
S=input()
K=int(input())
a=0
for j in S:
	a=a+1
	if j!='1':
		print(j)
		break
	if a==K:
		print('1')
		break

Solution (Python):
S=input();K=int(input())-1;p=0
while'1'==S[p]and K:K-=1;p+=1
print(S[p])

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

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

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

Solution (Python):

S = input()
K = int(input())
tmp = S.replace("1", "")


i = 0

while i < len(S):
	if S[i] != '1':
		break
	i += 1

print(1 if K - 1 < i else tmp[0])

Solution (Python):
s = str(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())
one = 0
two = ''
for c in s:
    if c=='1':
        one += 1
    else:
        two = c
        break
if k<=one:
    print(1)
else:
    print(two)

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

count = 0
for i in s:
    if i == '1':
        count += 1
    else:
        break

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

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

Solution (Python):
import numpy as np

s = input()
k = input()

for i, str in enumerate(s, 1):
    if str != "1":
        print(str)
        exit()

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

Solution (Python):


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

ans = list(str(S))

for i in range(len(ans)):
    if int(ans[i]) != 1:
        break
if i + 1 <= K:
    print(ans[i])
else:
    print(1)

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

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

if K <= r:
    result = "1"
else:
    result = c

print(result)

Solution (Python):
import sys

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

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

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

Solution (Python):
S=input()
K=int(input())
co=0	
a=0
for j in S:
	a=a+1
	if j!='1':
		print(j)
		co=1
		break
	if a==K:
		break
if co==0:
	print('1')

Solution (Python):
def solv(S):
    for i in range(0, len(S)):
        if S[i] != '1':
            return i
    return -1


S = input()
K = int(input())
ans = solv(S)
if ans == -1:
    print(1)
elif ans + 1 > K:
    print(1)
else:
    print(S[ans])

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

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

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

first = '1'
threshold = float('inf')
for i in range(len(s)):
    if s[i] != '1':
        first = s[i]
        threshold = i
        break

if k - 1 < threshold:
    print(1)
else:
    print(first)

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

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

cnt = 0
for s in S:
    s = int(s)
    if s == 1:
        cnt += 1
        if cnt == K:
            re = 1
            break
    else:
        re = s
        break
print(re)

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

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

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

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

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

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

Solution (Python):



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

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

print(ans)

Solution (Python):
def func(N, K):
    for n in range(len(N)):
        if N[n] != '1':
            if K > n:
                return N[n]
    return 1

print(func(input(), int(input())))

Solution (Python):
from math import pow
s = input()
k = int(input())

char = [ss for ss in s]


res = '1'

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

print(res)

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

def func(N, K):
    for n in range(len(N)):
        if N[n] != 1:
            if K > n:
                return N[n]
    
    return 1

print(func(N, K))

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

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

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

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

for i, k in enumerate(range(K)):
    if S[k] != '1':
        print(S[k])
        break
    if i == K - 1:
        print('1')

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

total = 0

ans = 1

for i, c in enumerate(s, 1):
    if int(c) == 1:
        total += 1
    else:
        ans = c
        break
    if str(i) == k:
        break

print(ans)

Solution (Python):
def main():
    """
    Si: '1' to '9'
    1 <= |S| <= 100
    1 <=  K  <= 10^18

    5000兆: 5_000_000_000_000_000
        5 * 10^15
    """
    S = input()
    K = int(input())
    ans = f(S, K)
    print(ans)


def f(S, K):
    """
    10^18 <<<<<<<<<<<< 2^(5 * 10^15)
    """
    ans = "1"
    for i, c in enumerate(S, 1):
        if c != "1":
            return c
        elif i == K:
            return "1"

    return ans


def NG(S, K):
    """
    1: 不変
    2: 2^d
        day0: 2
        day1: 22
        day2: 2222
        day3: 22222222
    """
    import datetime
    day = 5 * (10 ** 15)
    ls = {1: 1}
    for i in range(2, 9+1):
        ls[i] = i ** day
        print(i, datetime.datetime.now())

    idx = 1
    for c in S:
        idx += ls[c]
        if idx >= K:
            return c


if __name__ == '__main__':
    main()

Solution (Python):
S=input()
K=int(input())
l=len(S)
r=0
q=-1
if l==1:
    print(int(S))
else:
    for i in range(0,l-1):
        if int(S[i]) != 1:
            r=int(S[i])
            q=i
            break
    if q>=K or q==-1:
        print(1)
    else:
        print(r)

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

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

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

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

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

ans = 0
if len(S) == 1:
    ans = S[0]
else:
    i = 0
    for i in range(len(S)):
        if S[i] != '1' and i < K:
            ans = S[i]
            break
        else:
            ans = S[0]
   
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 = input()
k = int(input())



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

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

Solution (Python):
s = input()
k = int(input())
for c in s:
    if (int(c) > 1):
        print(c)
        break
    k -= 1
    if k <= 0:
        print(c)
        break

Solution (Python):
import sys

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

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

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

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

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

a=[]
while S !=0:
  s=S%10
  a.append(s)
  S //=10
m=0

for i in range(1,len(a)+1):
  if a[-i]!=1:
    if i>K:
      ans=1
    else:
      ans=i
    break
  else:
    ans=1

print(a[-ans])

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

days = 5000 * (10 ** 12)
now = 0
for i in S:
    if int(i) == 1:
        now += 1
    
    if now == K or int(i) != 1:
        print(i)
        sys.exit()

Solution (Python):
S = int(input())
K = int(input())
S_list = [int(x) for x in list(str(S))]
 
def saiki(i):
  if i == len(S_list):
    print("1")
    exit()
  if K == i:
    print("1")
    exit()
  if S_list[i] > 1:
    print(S_list[i])
    exit()
  if S_list[i] == 1:
    saiki(i+1)
 
print(saiki(0))

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

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

Solution (Python):
s=input()
k=int(input())
import re
s1,s2=re.match('^(1*)([2-9])?',s).groups()
if(s1 and k<=len(s1)):
  print(1)
else:
  print(s2)

Solution (Python):
S = input()
K = input()
if len(K) > 100:
    K = 110
else:
    K = int(K)


def main():
    if S[0] != '1':
        print(S[0])
        return

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

    if i == len(S) - 1:
        print('1')
        return

    if K <= i:
        print('1')
        return

    print(S[i])


if __name__ == '__main__':
    main()

Solution (Python):
def main():
    S = input()
    K = int(input())
    S_splited = list(map(int, list(str(S))))
    offset = 0
    day = 5 * 10**18
    for i in S_splited:
        if i == 1:
            offset += 1
            if offset >= K:
                break
            continue
        else:
            break
    print(i)


if __name__ == "__main__":
    main()

Solution (Python):
n=input()
k=int(input())
c=0
for i in range(len(n)):
	if n[i] is '1':
		c+=1
	else:
		break

if c>=k:
	print('1')
else:
	print(n[c])

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

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

Solution (Python):
S = str(input())
K = int(input())
i = 0
if S[0] == '1' and K == 1:
    print(1)

elif list(map(int,list(S[:(K-1)]))).count(1) == K-1:
    print(S[K-1])


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

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

else :
    while(1):
        if list(S[:(K-1)])[i] == '1':
            i = i + 1
        elif i > K:
            print(S[1])

        else:
            print(list(S[:(K-1)])[i])
            break

Solution (Python):
n = input()
m = int(input())
counter = 0
for i in n:
	if int(i) == 1:
		counter += 1
	else:
		print(i)
		break
	if (counter == m):
		print (i)
		break

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

if all([x == 1 for x in org[:k]]):
    print('1')
else:
    for i in range(len(org)):
        if org[i] != 1:
            print(org[i])
            break

Solution (Python):
import numpy as np
s = input()
k = int(input())
index_num = 0
for i in s:
  ii = int(i)
  if ii == 1:
    index_num += 1
    if k == index_num:
      print(1)
      break
  else:
    print(i)
    break

Solution (Python):

import logging
import time
import math


class Solver:
    def __init__(self):
        self.s = ''
        self.k = 0

    
    def input_value(self):
        
        
        
        
        
        self.s = input()
        self.k = int(input())

    
    
    
    
    
    
    
    
    
    
    

    @staticmethod
    def run(s, k):
        
        i = 0
        while s[i] == '1':
            i += 1
            if i >= len(s) or i >= k:
                return '1'
        return s[i]

    @staticmethod
    def test():
        start_time = time.time()

        assert Solver.run('1214', 4) == '2', 'Error.'
        assert Solver.run('3', 157) == '3', 'Error.'
        assert Solver.run('299792458', 9460730472580800) == '2', 'Error.'
        assert Solver.run('123456789123456789123456789123456789123456789123456789123456789123456789123456789123456789123456789', 100000000000000000) == '2', 'Error.'
        assert Solver.run('11123', 2) == '1', 'Error.'
        assert Solver.run('11123', 3) == '1', 'Error.'
        assert Solver.run('11123', 4) == '2', 'Error.'
        assert Solver.run('11123', 5) == '2', 'Error.'

        elapsed_time = time.time() - start_time
        logging.debug('elapsed_time: {0}'.format(elapsed_time) + '[sec]')


if __name__ == '__main__':
    logging.basicConfig(level=logging.DEBUG)

    solver = Solver()
    

    solver.input_value()
    ans = solver.run(solver.s, solver.k)
    print(ans)

Solution (Python):
import math

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

n=0
for i in range(len(S)):
    if math.log10(int(S[i]))*5*(10**15)>=math.log10(K):
        break
    else:
        K-=int(S[i])**(5*(10**15))

print(S[i])

Solution (Python):
S = int(input())
K = int(input())
l = [int(x) for x in list(str(S))]
flag=0
flag2=0
i=0
j=0
ans = 0
if K<=len(l):
    while j<K and flag2 == 0:
        if l[j] == 1 or l[j]==0:
            ans = l[j]
            j = j + 1
        else:
            flag2 =1
            ans = l[j]
else:
    while flag ==0:
        if l[i] == 1 or l[i]==0:
            i = i + 1
        else:
            flag=1
            ans = l[i]
print(ans)

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

Solution (Python):
def mrinfinit(a, b):
    bf = list(set(a))
    rr = a[:b]
    sf = list(set(rr))

    if len(bf) == 1 and bf[0] == '1':
        return a[0]
    elif len(sf) == 1 and sf[0] == '1':
        return a[0]
    elif len(a) > 1:
        if '1' in a:
            a = a.replace('1', '')
            return a[0]
        else:
            return a[0]
    else:
        return a[0]


if __name__ == '__main__':
    la = input()
    lb = int(input())
    print(mrinfinit(la, lb))

Solution (Python):
S = input()
K = input()
k =int(K)
flag = 0
for i in range(len(S)):
    if S[i] =="1":
        if i == k-1:
            break
        continue
    elif S[i] =="2":
        print("2")
        flag = 1
    elif S[i] =="3":
        print("3")
        flag = 1
    elif S[i] =="4":
        print("4")
        flag = 1
    elif S[i] =="5":
        print("5")
        flag = 1
    elif S[i] =="6":
        print("6")
        flag = 1
    elif S[i] =="7":
        print("7")
        flag = 1
    elif S[i] =="8":
        print("8")
        flag = 1
    elif S[i] =="9":
        print("9")
        flag = 1

    break
if flag == 0:
    print("1")

Solution (Python):
inp = [input() for _ in range(2)]
s = inp[0]
k = int(inp[1])
j = 0

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

if j >= k:
  print(1)
else:
  print(ans)

Solution (Python):
s = list(input())
r = int(input())
if (len(list(set(s[:r]+["1"]))) == 1):
    print(1)
else:
    for i in s:
        if(i!="1"):
            print(i)
            break

Solution (Python):
import sys
S=input()
li=''.join(S)
S1=len(li)
m=[]

K=int(input())
ans=str(K)
k1=''.join(ans)
k2=len(k1)

for i in range(0,S1):
    if li[i]!='1' and i<K:
        print(li[i])
        sys.exit()

print('1')

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

cnt = 0

one_cnt = 0
for i in s:
    cnt += 1

    if i == "1":
        one_cnt += 1

    
    if cnt == len(s):
        ans = 1

    
    if i != "1":
        ans = i
        break


if k <= one_cnt:
    print(1)
else:
    print(ans)

Solution (Python):
n = input()
m = int(input())
j = 0
for i in n:
    j += 1
    if j == m:
        print(i)
        break
    elif i != "1":
        print(i)
        break

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

num = 1
one_cnt = 0
for i in s:
    if i != 1:
        num = i
        break
    else:
        one_cnt += 1
if (one_cnt >= K):
    print(1)
else:
    print(num)

Solution (Python):

S=[int(x) for x in list(input())]
K=int(input())
count=0
if len(S)==1:
    print(S[0])
else:
    for i, box in enumerate(S):
        if box==1:
            count+=1
            if count==K:
                print(1)
                break
        else:
            print(S[i])
            break

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

SL = list(S)
for i in range(0,101):
    if int(SL[i]) == 1:
        count1 += 1
    else:
        break
    if count1 == K:
        break

if count1 >= K:
    print(1)
else:
    if count1 >= 1:
        while "1" in SL:
            SL.remove("1")
    print(SL[0])

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

K = int(input())
cnt = 0

for i in range(len(S)):
	cnt += 1
	if(S[i]!=1 and K-1>i):
		ans = S[i]
		break

if(cnt==len(S) and K<=len(S)):
	print(S[K-1])
elif(cnt==len(S)):
	print(S[0])
else:
	print(ans)

Solution (Python):
input1 = raw_input().replace("\n", "")
input2 = int(raw_input().replace("\n", ""))

def count_ones(xs):
    count = 0
    for x in xs:
        if int(x) != 1:
            break
        else:
            count += 1
    return count

if int(input1[0]) > 1:
    print input1[0]
else:
    len_ones = count_ones(input1)
    if input2 <= len_ones:
        print 1
    else:
        print input1[len_ones]

Solution (Python):



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

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

    count_one = 0
    for c in s:
        if c == '1':
            count_one += 1
        else:
            break

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


main()

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

if '1' not in S:
  print(S[0])
  exit()


inf_num = list(filter(lambda x: x != '1', S[:K]))
if K <= len(S):
  if len(inf_num) == 0:
    print('1')
    exit()

print(inf_num[0])