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:
S = input()
K = int(input())

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

print(S[c])

Submission status: Runtime Error

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

c = -1
for s in S:
    if s == "1":
        c += 1
    else:
        break

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

Submission status: Runtime Error

Solution code:
A=5*10**15
s=input()
k=int(input())
l=0

for i in range(len(s)):
        l+=int(s[i])**A
        if k<l:
                print(int(s[i]))
                exit()

Submission status: Runtime Error

Solution code:
s = input()
k = int(input())
for i, v in enumerate(s):
  if v != "1":
    pos1 = i
    break
  
if k < pos1 + 1:
  print(1)
else:
  print(s[pos1])

Submission status: Runtime Error

Solution code:
import sys

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

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

Submission status: Runtime Error

Solution code:
import sys

stdin = sys.stdin

ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline().rstrip()  # ignore trailing spaces

s = input()
k = ni()
keta = 0
for i in range(len(s)):
    if s[i] == "1":
        continue
    else:
        keta = i + 1
        break
if k < keta:
    print("1")
else:
    print(s[keta])

Submission status: Runtime Error

Solution code:
import sys

stdin = sys.stdin

ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline().rstrip()  # ignore trailing spaces

s = input()
k = ni()
ans_idx = len(s)
for i in range(len(s)):
    if s[i] == "1":
        continue
    else:
        ans_idx = i
        break
if ans_idx - 1 >= k:
    print("1")
else:
    print(s[ans_idx])

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
s = input()
k = int(input())
i = 0
while s[i] == '1':
    i += 1
if k < i:
    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:
  cnt=0
  for i in range(len(s)):
    if s[i]=='1':
      cnt+=1 
    else:
      idx=i
      break
  if cnt>k:
    print('1')
  else:
    print(s[idx])

Submission status: Runtime Error

Solution code:
s = input()
k = int(input())
infinity = 5 * (10 ** 15) - 1

import math

i = 0
while k > 0:
  
  k -= math.floor(infinity * math.log(int(s[i]), 10)) + 1
  i += 1
  
print(s[i-1])

Submission status: Runtime Error

Solution code:
s = input()
k = int(input())
infinity = 5 * (10 ** 15) - 1

import math

i = 0
while k > 0:
  print(s[i])
  k -= math.floor(infinity * math.log(int(s[i]), 10)) + 1
  i += 1
  print(k)
  
print(s[i-1])

Submission status: Runtime Error

Solution code:
s = input()
k = int(input())
infinity = 5 * (10 ** 11) - 1

import math

i = 0
while k > 0:
  k -= math.floor(infinity * math.log(int(s[i]), 10)) + 1
  i += 1
  
print(s[i-1])

Submission status: Runtime Error

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

def check_one(sgn,arr):
    cnt = 0
    for i in range(sgn):
        if S[i] == '1':
            cnt += 1
    if cnt == sgn:
        return True

def first_num(arr):
    list = []
    for i in range(len(arr)):
        if arr[i] != '1':
            list.append(int(arr[i]))
    return list[0]
            

if len(S) > K:
    if check_one(K,S):
        print(1)
else:
    print(first_num(S))

Submission status: Runtime Error

Solution code:
def main():
    S = input()
    K = int(input())
    i = 0
    while S[i] == "1":
        i += 1
    if K <= i:
        return "1"
    else:
        return S[i]

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

Submission status: Runtime Error

Solution code:
def main():
    S = input()
    K = int(input())
    if S[0] == "1":
        if K == 1:
            return 1
        else:
            i = 0
            while S[i] == "1":
                i += 1
            return  int(S[i])
    else:
        return int(S[0])


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

Submission status: Runtime Error

Solution code:
import re

S = input().rstrip()
K = int(input())

i = re.search(r'[2-9]', S).start()

if K < i + 1:
    print(1)
else:
    if S[0] == '1':
        print(S[i])
    else:
        print(S[0])

Submission status: Runtime Error

Solution code:
def solve():
    s = input()
    return [c for c in s if c != "1"][0]


if __name__ == "__main__":
    print(solve())

Submission status: Runtime Error

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

Submission status: Runtime Error

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

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

if tmp > K :
    ans = 1
else:
    ans = S[tmp-1]

print(ans)

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:


import collections
import itertools
import sys


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

s = input()
k = getint()

t = list(itertools.takewhile(lambda s: s == '1', s))

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

Submission status: Runtime Error

Solution code:
n = int(input())
cnt = 0

for i in range(n):
    l, r = list(map(int, input().split(' ')))
    cnt += r - l + 1

print(cnt)

Submission status: Runtime Error

Solution code:
s = input()
k = int(input())
ans = "1"
for i in range(100):
    if s[i] != "1":
        ans = s[i]
        break

print(ans)

Submission status: Runtime Error

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

num1 = 0

for c in s:
    if c == "1":
        num1 += 1
    else:
        break

nex = s[num1]

if k <= num1:
    print(1)
else:
    print(nex)

Submission status: Runtime Error

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

n = 5 * 10 ** 15

for i in S:
  if (int(i) != 1):
    ans = int(i)
    break
print(ans)

Submission status: Runtime Error

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

cnt = 0
while s[cnt]=="1":
    cnt += 1
    
if cnt == 0:
    print(s[0])
elif cnt >= k:
    print(1)
else:
    print(s[cnt])

Submission status: Runtime Error

Solution code:
s = input()
k = int(input())
count = 0
while True:
  if s[count] == "1":
    count += 1
  else:
    break
if k > count:
  print(s[count])
else:
  print(1)

Submission status: Runtime Error

Solution code:
S = input()
K = int(input())
l = [int(s) for s in S if s != "1"]
print(l[0])

Submission status: Runtime Error

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

count = 0
for i in s:
  	count += 1
    if i != "1" or (count == n):
        print(i)
        break
else:
    print(1)

Submission status: Runtime Error

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

count = 0
for i in s:
  	count += 1
    if i != "1" or count == n:
        print(i)
        break
else:
    print(1)

Submission status: Runtime Error

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

def ones(s):
    ss = s[0]
    idx = 0
    while ss=="1":
        idx += 1
        ss = s[idx]
    return idx

if s[0]!="1":
    print(s[0])
else:
    idx = ones(s)
    if idx>=k:
        print("1")
    # else:
        # print(s[idx])

Submission status: Runtime Error

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

def ones(s):
    ss = s[0]
    idx = 0
    while ss=="1":
        idx += 1
        ss = s[idx]
    return idx

if s[0]!="1":
    print(s[0])
else:
    idx = ones(s)
    if idx>=k:
        print("1")
    else:
        print(s[idx])

Submission status: Runtime Error

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

def ones(s):
    ss = s[0]
    idx = 0
    while ss=="1":
        idx += 1
        ss = s[idx]
    return idx

if s[0]!="1":
    print(s[0])
else:
    idx = ones(s)
    if idx>k:
        print("1")
    else:
        print(s[idx])

Submission status: Runtime Error

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

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

Submission status: Runtime Error

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

n = -1
for i, ki = enumerate(s):
  if ki!='1':
	n = i+1
    break
    
if n<0 or k<n:
  print(1)
else:
  print(s[n-1])

Submission status: Runtime Error

Solution code:
import math
S = input()
K = int(input())
i = 0
while True:
    if S[i] == '1':
        if K == 1:
            break
        else:
            K-=1
            i+=1
    else:
        d = int( (math.log(int(S[i]))) * ((2**5)*(10**15)) ) + 1
        if d<K:K-=d
        else:break
        i += 1
print(S[i])

Submission status: Runtime Error

Solution code:
import math
S = input()
K = int(input())
i = 0
while True:
    print('first:',S[i])
    if S[i] == '1':
        if K == 1:
            break
        else:
            K-=1
            i+=1
    else:
        d = int( (math.log(int(S[i]))) * ((2**5)*(10**15)) ) + 1
        if d<K:K-=d
        else:break
        i += 1
print(S[i])

Submission status: Runtime Error

Solution code:
import math
S = input()
K = int(input())
i = 0
while True:
    if S[i] == '1':
        if K == 1:
            break
        else:
            K-=1
            i+=1
    else:
        d = int(math.log(int(S[i]))*5*10**15)
        if d<K:K-=d
        else:break
        i += 1
print(S[i])

Submission status: Runtime Error

Solution code:
import math
S = input()
K = int(input())
i = 0
while True:
    if S[i] == '1':
        if K == 1:
            break
        else:
            K-=1
            i+=1
    else:
        d = int(math.log(int(S[i]))*10**15)
        if d<K:K-=d
        else:break
        i += 1
print(S[i])

Submission status: Runtime Error

Solution code:
import math
S = input()
K = int(input())
i = 0
while True:
    if S[i] == '1':
        if K == 1:
            print(S[i])
        else:
            K-=1
            i+=1
    else:
        d = int(math.log(int(S[i]))*10**15)
        if d<K:K-=d
        else:break
        i += 1

Submission status: Runtime Error

Solution code:
import math
S = input()
K = int(input())
i = 0
while True:
    d = int(math.log(int(S[i]))*10**15)
    if d<K:K-=d
    else:break
    i += 1
print(S[i])

Submission status: Runtime Error

Solution code:
S = input()
K = int(input())
List = []
ans = 1
for i in range(len(S)):
    List.append(int(S[i]))
for j in range(len(S)):
    if List[j] != 1:
        ans = List[j]
        num = j+1
        break
if K < num:
    print(1)
else:
    print(ans)

Submission status: Runtime Error

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

lst = []
while S > 0:
    lst.append(S%10)
    S //= 10 # 必須
lst.reverse()
#print(lst[0])
j = 0
n = 0
while lst[j] == 1:
    n = j+1
    j += 1
#print('n =',n)
if K <= n:
    print(1)
else:
    print(lst[n])

Submission status: Runtime Error

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

lst = []
while S > 0:
    lst.append(S%10)
    S //= 10 # 必須
lst.reverse()
#print(lst[0])
j = 0
n = 0
while lst[j] == 1:
    n = j+1
    j += 1
print('n =',n)
if K <= n:
    print(1)
else:
    print(lst[n])

Submission status: Runtime Error

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

lst = []
i = int(S)
while i > 0:
    lst.append(i%10)
    i //= 10 # 必須
lst.reverse()
print(lst[0])
if K == 1:
    print(lst[0])
else:
    if lst[0] == 1:
        print(lst[1])
    else:
        print(lst[0])

Submission status: Runtime Error

Solution code:
import math

s = list(map(int, input().split()))
k = input()
s_len_f = len(s)
s_len_l = math.log(s)*5000000000000000
len = s_len_l[0]
for i in range(s_len_f):
    if  math.log(k)<=len:
        ans_num = i
        break
    else:
        len += s_len_l[i+1]

print(s[ans_num])

Submission status: Runtime Error

Solution code:
s = list(map(int, input().split()))
k = input()
s_len_f = len(s)
s_len_l = log(s)*5000000000000000
len = s_len_l[0]
for i in range(s_len_f):
    if  log(k)<=len:
        ans_num = i
        break
    else:
        len += s_len_l[i+1]

print(s[ans_num])

Submission status: Runtime Error

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

if len(S) == 1:
    ans = S[0]
else:
    for i in S:
        if not i == "1":
            ans = i
            break
print(ans)

Submission status: Runtime Error

Solution code:
s = list(map(int, input().split()))
k = input()
s_len_f = len(s)
s_len_l = s**5000000000000000
len = s_len_l[0]
for i in range(s_len_f):
    if  k<=len:
        ans_num = i
        break
    else:
        len += s_len_l[i+1]

print(s[ans_num])

Submission status: Runtime Error

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


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

print(ans)

Submission status: Runtime Error

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

if len(S)==1:
    print(S[0])
    
else:
    lst = []
    for i in range(len(S)):
        if S[i]!='1':
            lst.append(i)
        
    if lst==[]:
        print('1')
    else    
        if K<lst[0]:
            print('1')
        else:
            print(S[lst[0]])

Submission status: Runtime Error

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

if len(S)==1:
    print(S[0])
    
else:
    lst = []
    for i in range(len(S)):
        if S[i]!='1':
            lst.append(i)
        
    if K<lst[0]:
        print('1')
    else:
        print(S[lst[0]])

Submission status: Runtime Error

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

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

print(ans)

Submission status: Runtime Error

Solution code:
s = list((input()))
k = int(input())
if "1" in s:
	flag = True
	if k > 100:
		k = 100
	for i in range(k):
		if s[i] != "1":
			if flag:
				p = int(s[i])
			flag = False
	if flag:
		print(1)
	else:
		print(p)
else:
	print(int(s[0]))

Submission status: Runtime Error

Solution code:
S = input()
K = int(input())
for s in S:
    if s == "1":
        if K == 1:
            print(1)
            break
        k -= 1
        continue
    print(s)
    break

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
import re

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

if not re.search(r'[^1]',S).start():
  print(1)
elif re.search(r'[^1]',S).start() >= K:
  print(1)
else:
  print(S[re.search(r'[^1]',S).start()])

Submission status: Runtime Error

Solution code:
import re

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

if re.search(r'[^1]',S).start() >= K:
  print(1)
else:
  print(S[re.search(r'[^1]',S).start()])

Submission status: Runtime Error

Solution code:
S,K,c=input(),int(input()),0
while c<K and S[c]=='1':c+=1
print(S[c])

Submission status: Runtime Error

Solution code:
S=input()
K=int(input())
c=0
a='1'
while c<K and S[c]=='1':
 c+=1
print(S[c])

Submission status: Runtime Error

Solution code:
S = input()
K = int(input())
# print(S, K)
for i in range(len(S)):
    if i >= K:
        break
    if s != '1':
        print(s)
        exit()
print('1')

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
s = list(map(int,input()))
j = 1
for i in s:
	if i != 1:
		j = i
		break
    else:
		continue
print(j)

Submission status: Runtime Error

Solution code:
from sys import stdin
S = (stdin.readline().rstrip())
K = int(stdin.readline().rstrip())
cnt = 0
for i in S:
    if i == "1":
        cnt += 1
    else:
        ans = int(i)
        break
if cnt == K:
    ans = 1
print(ans)

Submission status: Runtime Error

Solution code:
from sys import stdin
S = (stdin.readline().rstrip())
K = int(stdin.readline().rstrip())
cnt = 0
for i in S:
    if i == "1":
        cnt += 1
    else:
        ans = i
if cnt == K:
    ans = 1
print(ans)

Submission status: Runtime Error

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

i=0
while i<=len(S):
    if S[i]=="1":
        i+=1
    else:
        break

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

Submission status: Runtime Error

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

i=0
while i<=len(S):
    if S[i]=="1":
        i+=1
    else:
        break

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

Submission status: Runtime Error

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

k = min(K,len(S))

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

Submission status: Runtime Error

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

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

Submission status: Runtime Error

Solution code:
s=input()
k=input()
if s[0]=='1' or len(s)==1:
    print(s[1])
else:
    for i in s:
        if int(i)>1:
            print(i)

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
s = int(input())
k = int(input())
li = [int(k) for k in list(str(s))]
#print(li)
if k == 1:
  print(li[0])
else:
  print(li[1])

Submission status: Runtime Error

Solution code:
s = int(input())
k = int(input())
li = [int(k) for k in list(str(s))]
#print(li)
if k = 1:
  print(li[0])
else:
  print(li[1])

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

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

Submission status: Runtime Error

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

i = 0
while S[i] == '1' and i < len(S):
    i += 1
if K < i:
    print(1)
else:
    print(S[i])

Submission status: Runtime Error

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

i = 0
while S[i] == '1':
    i += 1
if K < i:
    print(1)
else:
    print(S[i])

Submission status: Runtime Error

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

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

Submission status: Runtime Error

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

i = 0

while s[i] == '1' and i < k:
  i += 1

print(int(s[i]))

Submission status: Runtime Error

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

i = 0

while s[i] == '1' and i < k:
  i += 1

print(s[i])

Submission status: Runtime Error

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

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

Submission status: Runtime Error

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

if s[:k] == '1'*k:
  print(1)
else:
  print(int(s.translate(str.maketrans('','','1'))[0]))

Submission status: Runtime Error

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

if k <= len(s):
  print(s[k-1])
elif s[:k] == '1'*k:
  print(1)
else:
  print(s.translate(str.maketrans('','','1'))[0])

Submission status: Runtime Error

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

if s[:k] == '1'*k:
  print(1)
else:
  print(s.translate(str.maketrans('','','1'))[0])

Submission status: Runtime Error

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

i = 0
while s[i] == '1' or i+1 < k:
	i += 1  
print(int(s[i]))

Submission status: Runtime Error

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

if k == 1:
  print(int(s[0]))
else:
  i = 0
  while s[i] == '1':
    i += 1
  print(int(s[i]))

Submission status: Runtime Error

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

for j in range(1,5*(10**15)):
  a = ''
  for i in range(len(s)):
    a += str(s[i])*s[i]**j
  if len(a) >= k:
    print(a[k-1])
    break

Submission status: Runtime Error

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

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

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

Submission status: Runtime Error

Solution code:
# -*- coding: utf-8 -*-
import sys
import copy
import collections
from bisect import bisect_left
from bisect import bisect_right
from collections import defaultdict
from heapq import heappop, heappush
import numpy as np
	
def main():
	S = input()
	S = list(S)
	K = int(input())
	
	if len(S) == 1:
		print(S[0])
	"""
	L = []
	for i in range(len(S)):
		if i == 0:
			tmp = int(S[i])
			if tmp == 1:
				L.append((i+1, tmp))
			else:
				tmp = (tmp ** ((5000 * 10000000000000)-1)) // 10
				L.append((i+1, tmp))
			continue
			
		_, base = L[i-1]
		tmp = int(S[i])
		if tmp == 1:
			tmp = 1
		else:
			tmp = (tmp ** ((5000 * 10000000000000)-1)) // 10
		L.append((i+1, tmp+base))
		
	for i in L:
		index, keta = i
		if i == 0:
			if K < keta:
				print(S[index])
				break
		if K < keta:
			print(S[index-1])
			break
			
	print(L)
	"""
	
	tmp = []
	for i in S:
		flg = False
		if int(i) == 1:
			tmp.append(1)
		else:	
			tmp.append(int(i))
			if flg = True:
				break
			flg = True
	
	a = np.random.randint(100)
	
	if len(tmp) < K:
		if a == 0
			print(tmp[-1])
		else:
			print(tmp[-2])
	else:
		tmp[K-1]
	
if __name__ == "__main__":
	main()

Submission status: Runtime Error

Solution code:
n=list(input())
k=int(input())
if len(n)==1:
  print('1')
else:
  one_list=[]
  while len(n)!=0:
    if n[0]=='1':
      one_list.append(n.pop(0))
    else:
      break
  if 0<len(one_list)<=k:
    print('1')
  else:
    print(n[0])

Submission status: Runtime Error

Solution code:
n=list(input())
k=int(input())
if len(n)==1:
  print('1')
else:
  one_list=[]
  while len(n)!=0:
    if n[0]=='1':
      one_list.pop(n.pop(0))
    else:
      break
  if 0<len(one_list)<=k:
    print('1')
  else:
    print(n[0])

Submission status: Runtime Error

Solution code:
n=list(input())
k=int(input())
if len(n)==1:
  print('1')
else:
  one_list=[]
  while 1==1:
    if n[0]=='1':
      one_list.pop(n.pop(0))
    else:
      break
  if 0<len(one_list)<=k:
    print('1')
  else:
    print(n[0])

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
"""
Sの文字列、最初が何かに依存しそう
"""


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

if S[0] == "1":
    len_one = 0
    for s in S:
        if s == 1 and flag == 0:
            len_one += 1
        else:
            flag = 0
    
    if K <= len_one:
        ans = 1
    else:
        ans = S[1]

else:
    ans = S[0]

print(ans)

Submission status: Runtime Error

Solution code:
S = input()
K = int(input())
if S[0] == '1' and len(S) > 1:
    while S[0] == '1':
        S = S[1:]
print(S[0])

Submission status: Runtime Error

Solution code:
#!/usr/bin/env python3
import sys
from itertools import *


def solve(S: str, K: int):
    onelen = len(list(takewhile(lambda x:x=="1",S)))
    res = "1" if onelen > K else S[onelen]
    print(res)
    return


# Generated by 1.1.4 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    S = next(tokens)  # type: int
    K = int(next(tokens))  # type: int
    solve(S, K)

if __name__ == '__main__':
    main()

Submission status: Runtime Error

Solution code:
from sys import stdin

S = stdin.readline().rstrip()
K = int(stdin.readline().rstrip())

for x in range(10 ** 2):
    if int(S[x]) > 1:
        print(S[x])
        break

Submission status: Runtime Error

Solution code:
s = input()
k = int(input())
for int(c) in s:
  if c != 1:
    print(c)
    exit(0)

Submission status: Runtime Error

Solution code:
import re

S = input()
K = int(input()[:4])

n1i = re.search("[2-9]", S).start()

print(S[min(n1i, K - 1)])

Submission status: Runtime Error

Solution code:
import re

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

n1i = re.search("[2-9]", S).start()

print(S[min(n1i, K)])

Submission status: Runtime Error

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

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

print(["1", S[c]][not((K - 1) < c)])

Submission status: Runtime Error

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

c = 0
for si in s:
    if si == "1":
        c += 0
    else:
        a = si
        break

print("1" if k - c <= 0 else a)

Submission status: Runtime Error

Solution code:
s = input()
k = int(input())
for i in range(k+1):
    if s[i] == '1':
        continue
    else:
        print(s[i])
        break
else:
    print('1')

Submission status: Runtime Error

Solution code:
#include <iostream>
#include <algorithm>
#include <cstdio>
#include <regex>
#include <cmath>
#include <vector>
#include <queue>
#include <functional>
#include <numeric>
#include <iomanip>
#include <stack>
#include <string>
#include <map>
#include <set>
using namespace std;
typedef long long ll;

int main () {
    string s;
    cin >> s;
    ll one = 0, nonone = 0;
    for (int i = 0; i < s.size(); i++)
    {
        if(s[i] == '1') {
            one = i;
        }else {
            nonone = (int)(s[i] - '0');
            break;
        }
    }
    ll k, ans = 0;
    cin >> k;
    if(one + 1 >= k) {
        ans = 1;
    }else {
        ans = nonone;
    }
    cout << ans << endl;
}

Submission status: Runtime Error

Solution code:
s=input()
k=int(input())
if s[0]!='1':
  print(s[0])
else:
  pos=0
  for i in range(len(s)):
    if i!=s[:i].count('1'):
      break
    pos=i
  if k<=pos:
    print('1')
  else:
    print(s[pos+1])

Submission status: Runtime Error

Solution code:
S = list(input())
K = int(input())
if not S[0] == "1":
    print(S[0])
else:
    print(S[1])

Submission status: Runtime Error

Solution code:
S = input().strip()
K = int(input().strip())
for i in range(K):
  if S[i] == '1':
    continue
  else:
    print(S[i])
    exit()
print(S[K])

Submission status: Runtime Error

Solution code:
#coding: utf-8
N = list(map(int, list(input())))
K = int(input())
if N[0] == 1:
    print(N[1])
else:
    print(N[0])

Submission status: Runtime Error

Solution code:
#!/usr/bin/env python3
import numpy as np
import math
import re

S = input()
K = input()

if S[0] == '1':
    print(S[1])
else:
    print(S[0])

Submission status: Runtime Error

Solution code:
n = input()
k = input()


if len(n) == 1:
  print(n)
else:
  if k == "1":
    print(n[0])
  else:
    for i  in range(max(int(k), len(n))):
      if n[i] != "1":
        print(n[i])
        exit
      else:
        print(1)

Submission status: Runtime Error

Solution code:
n = input()
k = input()


if n[0] == "1":
  print(n[1])
else:
  print(n[0])

Submission status: Runtime Error

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

k = -1
while S[k+1] == "1":
  k += 1

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

Submission status: Runtime Error

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

k = -1
while S[k+1] == "1":
  k += 1
  print(k)

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

Submission status: Runtime Error

Solution code:
s=input()
k=int(input())
ans=1
for i in range(len(s)):
  if s[i] !="1" and ans==1:
    ans=int(s[i])
    ans_c=i+1
print(ans if ans_c<=k else 1)

Submission status: Runtime Error

Solution code:
#!/usr/bin/env python3
import sys


def solve(S: int, K: int):
    HOGE = 5000000000000000
    for c in S:
        if K == 0:
            ret = 1
            break
        if c == '1':
            K -= 1
        else:
            ret = c
            break
    print(ret)
    return


def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    S = str(next(tokens))  # type: int
    K = int(next(tokens))  # type: int
    solve(S, K)

if __name__ == '__main__':
    main()

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
s = input()
t  =input()
print(s.replace('1','')[0])

Submission status: Runtime Error

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


for i, v in enumerate(s):
    if v != "1":
        break
after = "1" * i + v * 100
print(after[min(len(s), k)])

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
S = input()
K = int(input())
ret = "1"
for i in K:
    if len(S) <= K:
        break
    if i != "1":
        ret = i
        break
print(ret)