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



Sample input:
1214
4


Sample output:
2

Submission status: Runtime Error

Solution code:
import re
S = input()
K = int(input())

next_t = S
now_t = ""

while next_t.ljust(K)[:K] != now_t.ljust(K)[:K]:
    now_t = next_t
    next_t = re.sub(r"[2]","22", next_t)
    next_t = re.sub(r"[3]","333", next_t)
    next_t = re.sub(r"[4]","4444", next_t)
    next_t = re.sub(r"[5]","55555", next_t)
    next_t = re.sub(r"[6]","666666", next_t)
    next_t = re.sub(r"[7]","7777777", next_t)
    next_t = re.sub(r"[8]","88888888", next_t)
    next_t = re.sub(r"[9]","999999999", next_t)

print(next_t[K])

Submission status: Runtime Error

Solution code:
S = input()
K = int(input())
if(S[0]!='1'):
  print(S[0])
else:
  i=0
  while(S[i]=='1'):
    i += 1
  if(K<=i):
    print('1')
  else:
    print(S[i])

Submission status: Runtime Error

Solution code:
S = int(input())
K = int(input())
if(S[0]!='1'):
  print(S[0])
else:
  i=0
  while(S[i]=='1'):
    i += 1
  if(K<=i):
    print('1')
  else:
    print(S[i])

Submission status: Runtime Error

Solution code:
import sys

S, K = [int(i) for i in input()], int(input())

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

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

Submission status: Runtime Error

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

while True:
    if s[0] == '1':
        s = s[1:]
    elif s[0] != '1':
        ans = s[0]
        break
    if s == []:
        ans = 1
        break
print(ans)

Submission status: Runtime Error

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

i = 0
while True:
    if s[i] == '1':
        i += 1
    elif s[i] != '1':
        ans = s[i]
        break
print(ans)

Submission status: Runtime Error

Solution code:
S = input()
K = int(input())
S_list = []
infinity = 50000000000000
S_str = str()
for i in range(len(S)):
    if int(S[i]) != 1:
        S_list.append(S[i])
        break
    else:
        pass
print(S_list[0])

Submission status: Runtime Error

Solution code:
S = str(input())
k = int(input())
if len(S) == 1:
    print(S)
    exit()
for i in range(10):
    if S[i] == "1" and int(S[i]) == k:
        print("1")
        break
    elif S[i] != "1":
        print(S[i])
        break

Submission status: Runtime Error

Solution code:
S = str(input())
k = int(input())
if len(S) == 1:
    print(S)
    exit()
for i in range(10):
    if S[i] == "1" and int(S[i]) == k:
        print("1")
    elif S[i] != "1":
        print(S[i])
        break

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
S=input()
K=int(input())
notonehead=min([S.find(str(i)) for i in range(2,10) if S.find(str(i))!=-1])
notone=S[notonehead]
print(1) if K-1<notonehead else print(str(notone))

Submission status: Runtime Error

Solution code:
s = input()
k = int(input())
onesum = 0
while s[0] == "1" and len(s) > 0:
    s = s[1:]
    onesum += 1
if k <= onesum:
    print(1)
else:
    print(s[0])

Submission status: Runtime Error

Solution code:
s = input()
k = int(input())
onesum = 0
while s[0] == "1" and len(s) > 0
    s = s[1:]
    onesum += 1
if k <= onesum:
    print(1)
else:
    print(s[0])

Submission status: Runtime Error

Solution code:
s = input()
k = int(input())
onesum = 0
while s[0] == "1":
    s = s[1:]
    onesum += 1
if k <= onesum:
    print(1)
else:
    print(s[0])

Submission status: Runtime Error

Solution code:
s = input()
K = int(input())
len = len(s)
judge = True

if len == 1:
	print(s)
	exit()

i = 0
while judge:
	if s[i] == "1":
		i += 1
	else:
		judge = False
		rec = i
		next = int(s[i])
		
	if i == len-1:
		judge = False


if K > rec:
	print(next)
else:
	print("1")

Submission status: Runtime Error

Solution code:
s = input()
K = int(input())
len = len(s)
judge = True

i = 0
while judge:
	if s[i] == "1":
		i += 1
	else:
		judge = False
		rec = i
		next = int(s[i])
		
	if i == len-1:
		judge = False


if K > rec:
	print(next)
else:
	print("1")

Submission status: Runtime Error

Solution code:
s = input()
K = int(input())

judge = True

i = 0
while judge:
	if s[i] == "1":
		i += 1
	else:
		judge = False
		rec = i
		next = int(s[i])

if K > rec:
	print(next)
else:
	print("1")

Submission status: Runtime Error

Solution code:
s=input()
k=int(input())
li=[i for i in s]
a=0
for j in li:
  if a+j**5e15>=k:
    break
  print(j)
  else:
    a+=j**5e15

Submission status: Runtime Error

Solution code:
N=int(input())
K=int(input())

if K==1:
  print(N[0])
  
else:
  if N[0]==1:
    print(N[1])
  else:
    print(N[0])

Submission status: Runtime Error

Solution code:
s=input()
k=int(input())
if s[0]=="1":
  print(s[1])
else:
  print(s[0])

Submission status: Runtime Error

Solution code:
S = list(input())
K = int(input())
n = 0
for i in range(len(S)):
    if S[i] != "1":
        n = i +1
        break

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

Submission status: Runtime Error

Solution code:
S = list(input())
K = int(input())
n = 0
for i in range(len(S)):
    if S[i] != "1":
        break
    else:
        n += 1

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

Submission status: Runtime Error

Solution code:
S = input()
K = int(input())
n = 0
for i in range(len(S)):
    if S[i] != "1":
        break
    else:
        n += 1

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

Submission status: Runtime Error

Solution code:
S = input()
K = int(input())
index = 0
for i in range(len(S)):
    if S[i] != "1":
        break
    else:
        n += 1

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

Submission status: Runtime Error

Solution code:
S = input()
K = int(input())
n = 0
for i in range(len(S)):
    if S[i] != "1":
        break
    else:
        n += 1

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

Submission status: Runtime Error

Solution code:
S = input()

K = int(input())

tmp = 0
index = 0
res = ""

while K > tmp:
    if S[index] == "1":
        res = "1"
    else:
        res = S[index]
        break;
    index += 1

print(res)

Submission status: Runtime Error

Solution code:
S = input()
K = int(input())
if S[:K] == '1'*K:
    print(1)
else:
    print(S.replace('1', '')[0])

Submission status: Runtime Error

Solution code:
n=list(input())
m=int(input())
i=0
for t in range(len(n)):
  if n[t]!="1":
    i=t+1
    break
if m<i:
  print(1)
else:
  print(int(n[i]))

Submission status: Runtime Error

Solution code:
n=list(input())
m=int(input())
i=0
for t in range(len(n)):
  if n[t]=="1":
    pass
  else:
    i=t+1
    break
if m>=i:
  print(int(n[i]))
else:
  print(1)

Submission status: Runtime Error

Solution code:
n=list(input())
m=int(input())
i=0
for t in range(100):
  if n[t]=="1":
    pass
  else:
    i=t+1
if m=>i:
  print(str(n[i]))
else:
  print(1)

Submission status: Runtime Error

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

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
s = str(input())
k = int(input())
if s[:k] == ["1"]*k:
    ans = "1"
else:
    ans = s[:k].replace("1", "")[0]
print(ans)

Submission status: Runtime Error

Solution code:
s = str(input())
k = int(input())
for i in s:
    if i != "1":
        ans = i
        break
print(ans)

Submission status: Runtime Error

Solution code:
S = list(input())
K = int(input())
S = [int(i) for i in S]
if K == 1:
    print(S[0])
else:
    print(S[1])

Submission status: Runtime Error

Solution code:
S = input().split()
K = int(input())
S = [int(i) for i in S]
if S[0] == 1:
    print(S[1])
else:
    print(S[0])

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
S = input()
K = int(input())
for s in S:
  if int(s)==1:
	K-=1
    if K==0:
      print(s)
      exit()
  else:
    print(s)
    exit()

Submission status: Runtime Error

Solution code:
print(max(1,input()[:int(input())].replace("1","")[:1]))

Submission status: Runtime Error

Solution code:
print(max(1,[int(i)for i in input()[:int(input())]if i!="1"][0]))

Submission status: Runtime Error

Solution code:
print([i for i in input()[:int(input())]if i!="1"][0])

Submission status: Runtime Error

Solution code:
s=input()
k=int(input())
fl=0
t=0
for i in range(len(s)):
  if s[i]=='1' and fl=0:
    t+=1
  else:
    if fl==0:
      ans=s[i]
      fl=1
if t<=k:
  ans='1'
print(ans)

Submission status: Runtime Error

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

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

Submission status: Runtime Error

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

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

Submission status: Runtime Error

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

a = 0
b = 0

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

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
def solve(string):
    s, k = string.split()
    if len(s) == 1:
        return s
    counter = 0
    for _s in str(s):
        if _s == "1":
            counter += 1
            continue
        break
    return "1" if len(k) < 4 and int(k) < counter else s[counter]


if __name__ == '__main__':
    print(solve('\n'.join([input(), input()])))

Submission status: Runtime Error

Solution code:
def solve(string):
    s, k = string.split()
    if len(s) == 1:
        return s
    k = int(k)
    counter = 0
    for _s in str(s):
        if _s == "1":
            counter += 1
            continue
        break
    return "1" if k < counter else s[counter]


if __name__ == '__main__':
    print(solve('\n'.join([input(), input()])))

Submission status: Runtime Error

Solution code:
def solve(string):
    s, k = map(int, string.split())
    counter = 0
    for _s in str(s):
        if _s == "1":
            counter += 1
            continue
        break
    return str(s) if len(str(s)) == 1 else "1" if k < counter else str(s)[counter]


if __name__ == '__main__':
    print(solve('\n'.join([input(), input()])))

Submission status: Runtime Error

Solution code:
def solve(string):
    s, k = map(int, string.split())
    counter = 0
    for _s in str(s):
        if _s == "1":
            counter += 1
            continue
        break
    return str(s) if len(str(s)) == 1 else "1" if k < counter else str(s)[counter]


if __name__ == '__main__':
    print(solve('n'.join([input(), input()])))

Submission status: Runtime Error

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

if count<K and count>0:
  print(S[1])
elif count>=K:
  print(S[count])
else:
  print(S[0])

Submission status: Runtime Error

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

if count > 0:
  print(S[count])
else:
  print(S[0])

Submission status: Runtime Error

Solution code:
s=input()
input()
if s.count("1")==len(s):
    print(1)
else:
    i=0
    while s[i]!="1":
        i+=1
    print(s[i])

Submission status: Runtime Error

Solution code:
s=input()
if s.count("1")==len(s):
    print(1)
else:
    i=0
    while s[i]!="1":
        i+=1
    print(s[i])

Submission status: Runtime Error

Solution code:
S = list(map(int,input().split()
print(S)

Submission status: Runtime Error

Solution code:
s=input()
input()
i=0
while s[i]=="1":
    i+=1
    if i==len(s)-1:
        break
print(s[i])

Submission status: Runtime Error

Solution code:
s=input()
k=int(input())
i=0
while s[i]=="1":
    i+=1
print(s[i])

Submission status: Runtime Error

Solution code:
S,k = int(input()),int(input())
s,t = [],[]
for j in range(len(S)):
  if S[i] != S[i+1]:
    i = 0
    s.append(S[i])
    t.append(len(S[:i+1]))
    S = S[i+1:]
  else:
    i += 1
m = 0
print(S[0])

Submission status: Runtime Error

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

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

Submission status: Runtime Error

Solution code:
for i,n in enumerate(int(input())):
  if n!= 1:
    break
print(n if i<int(input()) else 1)

Submission status: Runtime Error

Solution code:
for i,n in enumerate(int(input())):
  if n!= 1:
    break
print(n if i<input() else 1)

Submission status: Runtime Error

Solution code:
S = input()
K = input()
for i,n in enumerate(S):
  if n!= 1:
    break
print(n if i<K else 1)

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
s = input()
k = int(input())
if k == 1 and s[0] == '1':
  print(s[0])
else:
  print(s[1])

Submission status: Runtime Error

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

Submission status: Runtime Error

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

first = ''
for i in range(l):
	if s[i] != '1':
		first = s[i]
		pos = i
		break

print('1' if k <= pos else first)

Submission status: Runtime Error

Solution code:
a=input()
k=int(input())
if int(a)<10:
    a=str(int(a)*11)
i=0
x=0
while k>=0:
    if a[i]=='1':
        k-=1
        i+=1
        x=2
    else: 
        k=-1
        x=0
print(a[i-x])

Submission status: Runtime Error

Solution code:
a=input()
k=int(input())
i=0
while k>=0:
    if a[i]=='1':
        k-=1
        i+=1
    else: k=-1    
print(a[i])

Submission status: Runtime Error

Solution code:
a=input()
k=int(input())
x=5*pow(10,15)
i=0
while k>0:
    k-=int(str(a)[i])*x
    i+=1
print(str(a)[i-1])

Submission status: Runtime Error

Solution code:
a=input()
k=int(input())
x=5*math.pow(10,15)
i=0
while k>0:
    k-=int(str(a)[i])*x
    i+=1
print(str(a)[i-1])

Submission status: Runtime Error

Solution code:
s = input()
k = int(input())
ans = "1"
for i in s[:k]:
    if a!= "1":
        ans = a
        exit()
print(ans)

Submission status: Runtime Error

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

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

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

Submission status: Runtime Error

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

D=5000000000000000

tmp=0
for s in S:
  tmp+=int(s)*5000000000000000 if s!='1' else 1
  if tmp>K:
    print(s)

Submission status: Runtime Error

Solution code:
# ABC 106
def db(x): 
    global debug
    if debug: print(x)
debug = False
S = input()
K = int(input())
c5000 = 5*10**15
k = 0
for i in range(100):
    n = ord(S[i])-ord('0')
    if n>1: n *= c5000
    k += n
    db((i,k))
    if k>=K:
          print(S[i])
          break

Submission status: Runtime Error

Solution code:
s = input()
k = int(input())
for i in range(k):
  s = s.replace("2","22").replace("3","333").replace("4","4444").replace("5","55555").replace("6","666666").replace("7","7777777").replace("8","88888888").replace("9","9999999")
print(s[k])

Submission status: Runtime Error

Solution code:
s=input()
k=int(input())
i=0
while s[i]=="1" and k:k,i=k-1,i+1
print(s[i])

Submission status: Runtime Error

Solution code:
S = input()
K = int(input())
Sdash = [x for x in S if not x == '1']  
n = S.index(Sdash[0])
if n >= K:
    print(1)
else:
    print(Sdash[0])

Submission status: Runtime Error

Solution code:
S = input()
K = int(input())
Sdash = [x for x in S if not x == '1']  
print(Sdash[0])

Submission status: Runtime Error

Solution code:
s = list(input())
k = int(input())
nonone = 0
for c in s:
    if c == '1':
        nonone += 1
    else: break
if k >= nonone:
    print(s[nonone])
else:
    print(1)

Submission status: Runtime Error

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

i = 0
while True:
    if S[i] != '1':
        print(S[i])
        break
    else:
        i += 1

Submission status: Runtime Error

Solution code:
s = input()
k = int(input())
for i,j in enumerate(s):
  if j == "1"
    if (i+1) == k:
      print(j)
      break
  else:
    print(j)
    break

Submission status: Runtime Error

Solution code:
S = list(input())
K = int(input())
i = 0
ans = 0

while K > 0:
    K = K - S[i]**(5*10**16 + 1)
    ans = S[i]
    i += 1

print(ans)

Submission status: Runtime Error

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

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

Submission status: Runtime Error

Solution code:
def reflesh_string(current_answer):
    index = min(K, len(current_answer))
    return current_answer[:index]

def update_string(string_answer):
    string_answer = string_answer.replace("1", "1")
    string_answer = string_answer.replace("2", "22")
    string_answer = string_answer.replace("3", "333")
    string_answer = string_answer.replace("4", "4444")
    string_answer = string_answer.replace("5", "55555")
    string_answer = string_answer.replace("6", "666666")
    string_answer = string_answer.replace("7", "7777777")
    string_answer = string_answer.replace("8", "88888888")
    string_answer = string_answer.replace("9", "999999999")
    return string_answer
  
def check_skip(current_answer):
    counter = [0 for i in range(9)]
    for k in range(min(K, len(current_answer))):
        counter[int(current_answer[k])] = 1
    if(sum(counter) == 1):
        return True
    
    if(sum(counter) == 2 and current_answer[min(K, len(current_answer)) - 1] != "1"):
        return True
    
    return False
    
S = input().strip()
K = int(input().strip())
for c in range(5 * 10**15):
    S = update_string(S)
    S = reflesh_string(S)
    if(check_skip(S)):
        break
print(S[min(K, len(S)) - 1])

Submission status: Runtime Error

Solution code:
import re
S = input()
K = int(input())

d = re.search('[2-9]', S)
if d.start() >= K:
  print("1")
else:
  print(d.group())

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
S = input()
K = int(input())
if S[0] != "1":
    print(S[0])
else:
    i = 0
    count = 0
    while S[i] == "1":
        count += 1
        i += 1
    if K <= count:
        print(1)
    else:
        print(S[i])

Submission status: Runtime Error

Solution code:
s=input()
k=int(input())
if s[0]=="1":
  try:
    if s[k-1]=="1":
      print('1')
    else:
      print(s[s.rfind("1")+1])
  except IndexError:
    print(s[s.rfind("1")+1])
else:
  print(s[0])

Submission status: Runtime Error

Solution code:
s=input()
k=int(input())
if s[0]=="1":
  print(s[1])
else:
  print(s[0])

Submission status: Runtime Error

Solution code:
S = input()
K = int(input())
counter = 0
num = 0
log = 0
for i in range(101):
    if int(S[i]) != 1:
        log = counter
        num = int(S[i])
        break
    counter += 1

if K <= log:
    print(1)
else:
    print(num)

Submission status: Runtime Error

Solution code:
S = input()
K = int(input())
counter = 0
num=0
log=0
for i in range(K + 1):
    if int(S[i]) != 1:
        log = counter
        num = int(S[i])
        break
    counter += 1

if K <= log:
    print(1)
else:
    print(num)

Submission status: Runtime Error

Solution code:
S = input()
K = int(input())
counter = 0
for i in range(K + 1):
    if int(S[i]) != 1:
        log = counter
        num = int(S[i])
        break
    counter += 1

if K <= log:
    print(1)
else:
    print(num)

Submission status: Runtime Error

Solution code:
S = input()
K = int(input())
counter = 0
for i in S:
    if int(i) != 1:
        log = counter
        num = int(i)
        break
    counter += 1

if K <= log:
    print(1)
else:
    print(num)

Submission status: Runtime Error

Solution code:
S = input()
K = int(input())
counter = 0
for i in S:
    if int(i) != 1:
        log = counter
        num = int(i)
        break
    counter += 1

if K == 1:
    print(S[0])
elif K <= log:
    print(1)
else:
    print(num)

Submission status: Runtime Error

Solution code:
S = input()
K = int(input())
a = 10 ** 18
print(a)
counter = 0
for i in S:
    if int(i) != 1:
        log = counter
        num = int(i)
        break
    counter += 1

if K == 1:
    print(S[0])
elif K <= log:
    print(1)
else:
    print(num)

Submission status: Runtime Error

Solution code:
S=input()
K=int(input())
counter=0
for i in S:
    if int(i)!=1:
        log=counter
        num=int(i)
        break
    counter+=1

if K==1:
    print(S[0])
elif K<=log:
    print(1)
else:
    print(num)

Submission status: Runtime Error

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

i = 0
counter = 0
while counter < K:
	counter += int(S[i])**5e15
	i += 1
print(S[i])

Submission status: Runtime Error

Solution code:
import sys
# N,M = [int(n) for n in input().split()]
# S = str(input())
# T = str(input())
S = str(input())
K = int(input())

for i in range(len(S)):
    if(S[i] == "1" and i+1 == K:
        print("1")
        sys.exit()
    elif(S[i]!="1"):
        print(S[i])
        sys.exit()

Submission status: Runtime Error

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

c = 0
for ch in s:
  if not ch == '1':
    break
  c += 1
n = s[c] if c < len(s) else None
a = n if n and c < k else S[0]
print(a)

Submission status: Runtime Error

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

c = 0
for ch in s:
  if not ch == '1':
    break
  c += 1
n = s[c] if c < len(S) else None
a = n if n and c < K else S[0]
print(a)

Submission status: Runtime Error

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

c = 0
for c in s:
  if not c == '1':
    break
  c += 1
n = s[c] if c < len(S) else None
a = n if n and c < K else S[0]
print(a)

Submission status: Runtime Error

Solution code:
s = input()
K = (int)(input())
k = K
for n in s:
  if n != '1':
    print(n)
    exit(1)
print('1')

Submission status: Runtime Error

Solution code:
s = input()
K = (int)(input())
k = K
for n in s:
  if k == 0:
    break
  elif n == '1':
    k = k-1
  else:
    print(n)
    exit(1)
if k == 0:
  print(s[K-1])

Submission status: Runtime Error

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

if k <= 5000000000000000:
  for n in s:
    if k == 0:
      print(n)
    elif n == '1':
      k = k-1
    else:
      print(n)

else:
  for n in s:
    if n == '1':
      k = k-1
    elif n == '2':
      if k >= 2ae0i0:
      else:
        print(n)
    else:
    print(n)

Submission status: Runtime Error

Solution code:
S = input().rstrip()
K = int(input())
c = 0
for item in S:
  if item == "1":
    c+=1
  else:
    break
n = S[c] if c < len(S) else None
a = n if n and c < K and else S[0]
print(a)

Submission status: Runtime Error

Solution code:
s = input()
k = int(input())
cnt  = 0
ans  = False
for i in range(k):
    if s[i] != '1':
        print(s[i])
        ans = True
if ans:
    print(1)

Submission status: Runtime Error

Solution code:
import sys

s = input()
k = int(input())
cnt  = 0
ans  = 0
while True:
    if cnt == len(s)-1:
        print("1")
        sys.exit(1)
    if s[cnt] != '1':
        print("{}".format(s[cnt]))
        sys.exit(1)
    cnt += 1

Submission status: Runtime Error

Solution code:
import sys

s = input()
k = int(input())
cnt  = 0
ans  = 0
while True:
    if cnt == len(s):
        print("1")
        sys.exit(1)
    if s[cnt] != '1':
        print(s[cnt])
        sys.exit(1)
    cnt += 1

Submission status: Runtime Error

Solution code:
s = input()
k = int(input())
cnt  = 0
ans  = 0
while True:
    if cnt == len(s)-1:
        print("1")
        exit(1)
    if s[cnt] != '1':
        print(s[cnt])
        exit(1)
    cnt += 1

Submission status: Runtime Error

Solution code:
s = input()
k = int(input())
cnt  = 0
ans  = 0
while True:
    if cnt == len(s):
        print("1")
        exit(1)
    if s[cnt] != '1':
        print(s[cnt])
        exit(1)
    cnt += 1

Submission status: Runtime Error

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

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

if flag:
    print(1)

Submission status: Runtime Error

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

count = 0

for i in range(len(a)):
    if count < k:
        num = int(a[i])
        count += num ** 5000000000000000
        
    else:
        break

print(num)

Submission status: Runtime Error

Solution code:
S=input()
K=int(input())
if K<=len(S):
    for s in S[:K]:
        if s!="1":
            break
    else:
        print("1")
else:
	for s in S:
    	if s!="1" :
        	print(s)
        	break

Submission status: Runtime Error

Solution code:
s=input()
k=int(input())
cnt = 0
x = s[0]
idx=0
while x == '1':
    x = s[idx]
    idx+=1
    cnt+=1
if cnt > 0:
    cnt -= 1
    
if k <= cnt:
    print(s[cnt-1])
else:
    print(s[cnt])

Submission status: Runtime Error

Solution code:
N,K=map(int,input().split())
print(1 if N%K != 0 else 0)

Submission status: Runtime Error

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

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

Submission status: Runtime Error

Solution code:
S = input()
K = long(input())

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
sS = input().rstrip()
#iK = int(input())
if sS[0] == "1":
    if iK !=1:
        print(sS[1])
    else:
        print(sS[0])
else:
    print(sS[0])

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
s=input()
k=int(input())
for a,i in enumerate(s):
    if i!="1":
        x=a
        y=i
        break

if x+1<=k: print(y)
else: print(1)

Submission status: Runtime Error

Solution code:
s=input()
k=int(input())
for a,i in enumerate(s):
    if i!="1":
        x=a
        y=i
        break

if x<=k: print(y)
else: print(1)

Submission status: Runtime Error

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

ans = 1

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

print(ans)

Submission status: Runtime Error

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

ans = 1

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

print(ans)

Submission status: Runtime Error

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

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

Submission status: Runtime Error

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

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

Submission status: Runtime Error

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

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

Submission status: Runtime Error

Solution code:
s=input()
S=''
k=int(input())
for num in s:
  S+=num*(int(num)**5000000000000000)
print(S[k])

Submission status: Runtime Error

Solution code:
# To Infinity
import re
s = input()
k = int(input())
ind = re.search(r'[23456789]', s).start()
if ind < k:
    try:
        print(s[ind])
    except:
        print(1)
else:
    print(1)

Submission status: Runtime Error

Solution code:
# To Infinity
import re
s = input()
k = int(input())
ind = re.search(r'[23456789]', s).start()
if ind < k:
    print(s[ind])
else:
    print(1)

Submission status: Runtime Error

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

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

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