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

Solution code:
import sys
S = list(input())
K = int(input())
cnt = 0
for i in S:
    if i == "1":
        cnt += 1
        if cnt == K:
            print(1)
            sys.exit()
    elif i != "1":
        print(i)
        sys.exit()

Submission status: Accepted

Solution code:
import sys
import numpy as np
S = list(input())
K = int(input())
cnt = 0
for i in S:
    if i == "1":
        cnt += 1
        if cnt == K:
            print(1)
            sys.exit()
    elif i != "1":
        print(i)
        sys.exit()

Submission status: Accepted

Solution code:
s = input()
k = int(input())
for i, j in enumerate(s):
  if i >= k:
    break
  if j != '1':
    print(j)
    quit()
print('1')

Submission status: Accepted

Solution code:
lim=5000000000000000
s=input()
k=int(input())
cnt=0
for i in s:
    if int(i)!=1:
        print(i)
        exit()
    else:
        cnt+=1
        if cnt==k:
            print(i)
            exit()

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
import sys
input = sys.stdin.readline

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

#1が続いたあと1出ない最初の文字があとはつづく

one_seq = 0
ret = 0
for i in s:
    if i == "1":
        one_seq+=1
    else:
        ret = i
        break

#one_seq = 左からxx文字1が続く
if k <= one_seq:
    print(1)
else:
    print(ret)

Submission status: Accepted

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


count = 0
for i in range(len(s)):
  if s[i] == "1":
    count = i+1
  else:
    st = s[i]
    break

if k <= count:
  print(1)
else:
  print(st)

Submission status: Accepted

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

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

print(1)

Submission status: Accepted

Solution code:
s=input()
k=int(input())
for i,c in enumerate(s):
  if c!='1' or i>=k-1:
    break
print(c)

Submission status: Accepted

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

Submission status: Accepted

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

key = 0
ans = '1'

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

Submission status: Accepted

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

Solution code:
S = input()
K = int(input())
for i,s in enumerate(S):
  if s!="1":
    print(s);exit()
  if i==K-1:
    print(s);exit()
print("1")

Submission status: Accepted

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

Submission status: Accepted

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

found = False
# 最初の1でない数字がどこに現れるか
for i in range(len(s)):
    if s[i] != '1':
        found = True
        break

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

Submission status: Accepted

Solution code:
import sys
sys.setrecursionlimit(10**6)
if sys.platform in (['ios','darwin','win32']):
	sys.stdin=open('Untitled.txt')
input = sys.stdin.readline
def INT(): return int(input())
def MAP(): return [int(s) for s in input().split()]

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

cnt = -1
for i in range(len(S)):
	if S[i] == str(1):
		cnt += 1
	else:
		break
if cnt == -1 or K-1 > cnt:
	print(S[cnt+1])
else:
	print(1)

Submission status: Accepted

Solution code:
s=list(input())
k=int(input())
if len(s)<k: #絶対１以外がある。
    i=0
    while s[i]=="1":
        i+=1
    print(s[i])
else: #k番目まですべて１の可能性もある
    ans=s[0]
    for i in range(k):
        if s[i]!="1":
            ans=s[i]
            break
    print(ans)

Submission status: Accepted

Solution code:
import re

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

m = re.search(r'[2-9]', s)

if m is None or k <= m.start():
    print(1)
else:
    print(m.group())

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

turn_on = True
for i in range(min(len(s), k)):
    if s[i] == '1':
        continue
    else:
        print(s[i])
        turn_on = False
        break

if turn_on:
    print('1')

Submission status: Accepted

Solution code:
import sys

s = sys.stdin.readline().rstrip()
k = int(sys.stdin.readline())

num=0
cnt1=0
for c in s:
    if c =='1':
        cnt1 +=1
    else:
        num = c
        break
#print(cnt1, num)

if k<=cnt1:
    print(1)
else:
    print(num)

Submission status: Accepted

Solution code:
s = input()
k = int(input())
if s[0] != "1":
  print(s[0])
else:
  # print(list(set(s[0:k]))[0])
  # print(set(s[0:k]))
  # print(len(s[0:k]))
  if list(set(s[0:k]))[0] == "1" and len(set(s[0:k])) == 1:
    print(1)
  else:
    for s_s in s:
      if s_s != "1":
        print(s_s)
        break

Submission status: Accepted

Solution code:

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

Submission status: Accepted

Solution code:
s=list(map(int,list(input())))
k=int(input())
for i in range(len(s)):
    if s[i]!=1:
        if i>=k:
            print(1)
        else:
            print(s[i])
        break
else:
    print(1)
'''
N=5000000000000

def groupby(a):
    a2=[[a[0],1]]
    for i in range(1,len(a)):
        if a2[-1][0]==a[i]:
            a2[-1][1]+=1
        else:
            a2.append([a[i],1])
    return a2

x=groupby(s)

for i in x:
    i[1]=i[1]*(i[0]**N)
計算量的に間に合わないのは明らか
print(x)
'''

Submission status: Accepted

Solution code:
s = input()
k = int(input())
cnt = 0
for c in s:
    if c != "1":
        break
    cnt += 1
if k <= cnt:
    print("1")
else:
    print(s[cnt])

Submission status: Accepted

Solution code:
s=list(input())
K=int(input())
 
ANS = 1
for i in range(K):
  if s[i] != '1':
    ANS = int(s[i])
    break
print(ANS)

Submission status: Accepted

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

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

Submission status: Accepted

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

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
S = [int(s) for s in list(input())]
K = int(input())

first_char = S[0]
if len(S) == 1:
    print(first_char)
elif first_char == 1:
    cnt = 0
    prev = 1
    i = 0
    while i < len(S) and prev == S[i]:
        prev = S[i]
        i += 1
    if K <= i:
        print(1)
    else:
        print(S[i])
else:
    print(first_char)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s=input()
k=int(input())
for x in s:
  if x=='1':
    k-=1
    if k==0:
      print(1)
      exit()
  else:
    print(x)
    exit()

Submission status: Accepted

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

cnt=0
for i in range(len(s)):
    if s[i]=="1":
        cnt+=1
        continue
    else:
        ans=s[i]
        break

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

Submission status: Accepted

Solution code:
S = list(input())
K = int(input())
for c in range(len(S)):
    if "1" == S[c] and c+1 < K:
        continue
    elif "1" == S[c] and c+1 <= K:
        print(1)
        exit()
    else:
        print(S[c])
        exit()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
S = input()
k = int(input())
cnt = 0
for i, s in enumerate(S):
  if s == "1":
    if i+1 == k:
      print(s)
      exit()
  else:
    print(s)
    exit()

Submission status: Accepted

Solution code:
S = input()
k = int(input())
d = {}
cnt = 0
for i, s in enumerate(S):
  if s == "1":
    cnt += 1
    if i+1 == k:
      print(s)
      exit()
  else:
    print(s)
    exit()
if cnt == len(S):
  print("1")

Submission status: Accepted

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

Submission status: Accepted

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

for s in S:
    if s == '1':
        onecount += 1
    else:
        answer = s
        break
if onecount >= K:
    answer = '1'
print(answer)

Submission status: Accepted

Solution code:
import re

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

m = re.search(r'[2-9]', S)
if m and m.start() < K:
    print(m.group())
else:
    print(1)

Submission status: Accepted

Solution code:
# 20191127
# 2*(2**5000兆)>Kなので左から1以外の文字を探せばよい

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

Submission status: Accepted

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

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

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

Submission status: Accepted

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

if S[0]==1:
  if K==1:
    print(1)
  else:
    for i in range(1,len(S)):
      if S[i] != 1:
        print(S[i])
        exit(0)
      if i == K-1:
        print(1)
        exit(0)
else:
  print(S[0])

Submission status: Accepted

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

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

if ind >= K:
    print(1)
else:
    print(ans)

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
s=input()
k=int(input())
if k<=len(s):
  if len(set(s[:k]))==1 and s[0]=="1":
    print(1)
    exit(0)
ans="1"
for c in s:
  if c!="1":
    ans=c
    break
print(ans)

Submission status: Accepted

Solution code:
s = input()
k = int(input())
len1 = 0
not1 = ''
for i in range(len(s)):
  if s[i] == '1':
    len1 += 1
  else:
    not1 = s[i]
    break

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

Submission status: Accepted

Solution code:
S = input()
K = int(input())
cnt = 0
for s in S:
    cnt += 1
    if s == "1" and cnt < K:
        continue
    else:
        print(s)
        exit()

Submission status: Accepted

Solution code:
S = str(input())
K = int(input())
L = []

count = 0
for s in S:
    count += 1
    if s != '1':
        t = s
        break
    t = s

if K < count:
    print(1)
else:
    print(int(t))

Submission status: Accepted

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


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

Submission status: Accepted

Solution code:
import sys
sl = list(input())
k = int(input())

for s in sl:
    s = int(s)
    k -= 1
    if k == 0:
        print(s)
        sys.exit()
    if s > 1:
        print(s)
        sys.exit()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n=input()
k=int(input())
if len(n)==1:
    print(n)
    exit()
cnt=0
for i in n:
    if i=="1":
        cnt+=1
    else:
        x=i
        break
print(1 if cnt>=k else x)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s = input()
k = int(input())
for char in s:
  if char != "1":
    print(char)
    break
  elif char == "1":
    k -= 1
    if k == 0:
      print(1)
      break

Submission status: Accepted

Solution code:
#ABC106C
s=input()
k=int(input())
cnt=0
while(s[cnt]=='1' and cnt!=len(s)-1):
    cnt+=1
if(k-1<cnt):
    print('1')
else:
    print(s[cnt])

Submission status: Accepted

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

if flag >= K:
    print(1)
else:
    print(ans)

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

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

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

Submission status: Accepted

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

ans = s[0]
cnt = 0
i=0
while i<len(s):
    cnt += int(s[i])**(5*(10*15))
    if (cnt >= k):
        ans = s[i]
        break
    i+=1
print(ans)

Submission status: Accepted

Solution code:
s=list(input())
k=int(input())
if len(s)==1 or k==1:
    print(int(s[0]))
else:
    for i in range(len(s)):
        if int(s[i])==1 and i!=len(s)-1 and (i+1)<k:
            continue
        else:
            print(int(s[i]))
            break

Submission status: Accepted

Solution code:
S = input()
K = int(input())
c = 0
for i, s in enumerate(S):
  if s != '1':
    c = i + 1
    break
  
if K < c:
  print(1)
else:
  print(S[c - 1])

Submission status: Accepted

Solution code:
import sys
s = input()
k = int(input())
l = len(s)
for i in range(k):
    if s[i]!="1":
        print(s[i])
        sys.exit()
print("1")

Submission status: Accepted

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

print('1' if firstNot1 >= K else S[firstNot1])

Submission status: Accepted

Solution code:
a = list(input())
k = int(input())

for i in a:
    if i != '1':
        print(i)
        break
    k -= 1
    if k == 0:
        print('1')
        break

Submission status: Accepted

Solution code:
S = input()
K = int(input())
for i,c in enumerate(S):
    if c!='1': break
print(1 if c=='1' or K<i+1 else c)

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
S = input()
K = int(input())
if S[0]*len(S) == S and S[0] == "1":
    print("1")
else:
    ans = 0
    ind = 0
    for i in range(len(S)):
        if S[i] != "1":
            ans = S[i]
            ind = i+1
            break
    if ind > K:
        print("1")
    else:
        print(ans)

Submission status: Accepted

Solution code:
from sys import stdin

s = stdin.readline().rstrip()
k = int(stdin.readline().rstrip())

zantei = 1
kai = 0
for i in s:
    if i == "1":
        kai += 1
    else:
        zantei = int(i)
        break

if zantei == 1:
    print(1)

elif kai >= k:
    print(1)
else:
    print(zantei)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
sys.setrecursionlimit(2147483647)
INF=float("inf")
MOD=10**9+7
input=lambda :sys.stdin.readline().rstrip()
def resolve():
    s=input()
    k=int(input())
    for i in range(k):
        if(s[i]!='1'):
            print(int(s[i]))
            return
    print(1)
resolve()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
#                         author:  kagemeka 
#                         created: 2019-11-09 15:46:24(JST)
### modules
## from standard library
import sys
# import collections
# import math
# import string
# import bisect
# import re
# import itertools
# import statistics
# import functools
# import operator
## from external libraries
# import scipy.special   
# import scipy.misc      
# import numpy as np 

def main():
    s = sys.stdin.readline().rstrip()
    k = int(sys.stdin.readline().rstrip())

    count = 0
    for i in range(len(s)):
        if s[i] == '1':
            count += 1
        else:
            last_1 = i - 1
            break
    else:
        last_1 = len(s) - 1
    
    if k <= count:
        ans = '1'
    else:
        ans = s[last_1 + 1]
    
    print(ans)
    



if __name__ == "__main__":
    # execute only if run as a script
    main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
S = list(input())
K = int(input())
count = '1'
for n in range(K):
    if S[n] != '1':
        count = S[n]
        break
print(count)

Submission status: Accepted

Solution code:
s = input()
k = int(input()) - 1
 
cnt1 = 0
for i in range(len(s)):
  if s[i] == '1':
    cnt1 += 1
  else:
    break
 
#print(cnt1, k)
if cnt1 > k:
  print(1)
else:
  print(s[cnt1])

Submission status: Accepted

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

for i, s in enumerate(S):
    if s != "1":
        print(s)
        break
    elif i + 1 == k:
        print(1)
        break
else:
    print(1)

Submission status: Accepted

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

con = 0

for i in range(0,len(S)):
  if S[i] == "1":
    con += 1
  else:break

if K <= con:
  print(1)
else:
  if S[0] == "1":
    S = S.replace("1","")
    print(int(S[0]))
  else:
    print(int(S[0]))

Submission status: Accepted

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

i = 1
while i <= k:
    if s[i-1] != '1':
        print(s[i-1])
        break
    elif i == k:
        print(s[i-1])
        break
    i += 1

Submission status: Accepted

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

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

if k == 1:
    print(s[0])
else:
    i = 1
    while i <= k:
        if s[i-1] != '1':
            print(s[i-1])
            break
        elif i == k:
            print(s[i-1])
            break
        i += 1

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
s=input()
k=int(input())
p=5*(10**15)
l=[]
n=len(s)
for i in range(n):
    if s[i]!='1':
        print(s[i])
        exit()
    elif i+1>=k:
        print(s[i])
        exit()
print(1)

Submission status: Accepted

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

flag = True
for i in range(min(len(S), K)):
    if S[i] == "1":
        pass
    else:
        if i < K:
            print(S[i])
            exit()
print(1)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N, K = [int(input()) for _ in range(2)]
listn = list(str(N))
a = []
if len(str(N)) < K:
    for i in range(len(str(N))):
        if listn[i] != str(1):
            a.append(str(listn[i]))
else:
    for i in range(K):
        if listn[i] != str(1):
            a.append(str(listn[i]))
if a == []:
    print(1)
else:
    print(a[0])

Submission status: Accepted

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

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

print(1 if k<i+1 else int(s[i]))

Submission status: Accepted

Solution code:
S = [int(x) for x in input()]
K = int(input())
if S[0] != 1:
    one = 0
    answer = S[0]
else:
    one = 0
    for i in range(len(S)):
        if S[i] == 1:
            one += 1
        else:
            break
    if one >= K:
        answer = 1
    else:
        answer = S[one]
print(answer)

Submission status: Accepted

Solution code:
s = input()
k = int(input())
if all(i=='1' for i in s[:k]):
  print(1)
  quit()
for i in s:
  if int(i)>=2:
    print(i)
    quit()

Submission status: Accepted

Solution code:
# ABC106C - To Infinity
def main():
    S = input().rstrip()
    K = int(input())
    for i in S[:K]:
        if i != "1":
            print(i)
            return
    print(1)


if __name__ == "__main__":
    main()

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
s=input()
n=len(s)
k=int(input())
t=5*10**15
for i in range(n):
    a=int(s[i])
    if a==1:
        k-=1
    else:
        print(a)
        break
    if k<=0:
        print(1)
        break

Submission status: Accepted

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

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

Submission status: Accepted

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

i = 0
while S[i] == '1' and i < len(S) - 1:
    i += 1

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#106c
S = str(input())
K = int(input())

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def solve(s, k):
    for i, c in enumerate(s, 1):
        if i == k:
            return c
        if c != '1':
            return c


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

print(solve(s, k))

Submission status: Accepted

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

Submission status: Accepted

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

if S[0] == '1':
    cnt = 0
    for s in S:
        if s == '1':
            cnt += 1
        else:
            not1 = s
            break
    if k <= cnt:
        print(1)
    else:
        print(not1)
else:
    print(S[0])

Submission status: Accepted

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

Submission status: Accepted

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

i=0
while S[i]=='1' and i<len(S)-1:
    i+=1

print([1,S[i]][K>i])

Submission status: Accepted

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

for i in range (0,len(S)):
  if (i <= K-1) and (int(S[i]) != 1):
    print(int(S[i]))
    sys.exit()
print("1")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s = list(input())
k = int(input())-1
s = s[:k+1]
nums = ["2","3","4","5","6","7","8","9"]

ans_idx = k
for n in nums:
    if n not in s:
        continue
    cur_idx = s.index(n)
    ans_idx = min(ans_idx,cur_idx)

print(s[ans_idx])

Submission status: Accepted

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

if len(set(s[:k])) == 1 and s[0]=="1":
  print(1)
else:
  for ss in s[:k]:
    if int(ss) != 1:
      print(ss)
      break
    else:
      continue

Submission status: Accepted

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

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

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

Submission status: Accepted

Solution code:
S = input()
K = int(input())
for i, s in enumerate(S, 1):
    if i < K and s != "1":
        print(s)
        exit()
    elif i == K:
        if s == "1":
            print("1")
            exit()
        else:
            print(s)
            exit()

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:

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

start = 1
pos = 0
for i in range(len(S)):
    if 1 != int(S[i]) and i < K:
        start = int(S[i])
        pos = i
        break


print(start)

Submission status: Accepted

Solution code:
import math
import copy
import sys
import fractions
import numpy as np
from functools import reduce

# ===FUNCTION===

def getInputInt():
    inputNum = int(input())
    return inputNum

def getInputListInt():
    outputoData = []
    inputData = input().split()
    outputData = [int(n) for n in inputData]

    return outputData

def getSomeInputInt(n):
    outputDataList = []
    for i in range(n):
        inputData = int(input())
        outputDataList.append(inputData)

    return outputDataList

def getSomeInputListInt(n):
    inputDataList = []
    outputDataList = []
    for i in range(n):
        inputData = input().split()
        inputDataList = [int(n) for n in inputData]
        outputDataList.append(inputDataList)

    return outputDataList

# ===CODE===

# n, k = map(int, input().split())
s = getInputInt()
k = getInputInt()

data = list(str(s))

ans = 1

for i in range(len(data)):
    if int(data[i]) != 1 and i < k:
        ans = int(data[i])
        break

print(ans)

Submission status: Accepted

Solution code:
# ABC106
S = input()
K = int(input())
cnt = 0
for s in S:
    if s == "1":
        cnt += 1
    else:
        break
if cnt >= K:
    print(1)
else:
    print(int(S[cnt]))

Submission status: Accepted

Solution code:
s=input()
S=[0]*len(s)
for i in range(len(s)):
  S[i]=int(s[i])
k=int(input())
ans=0
if len(s)>=k:
  if sum(S[:k])==k:
    print(1)
    ans=1
if ans!=1:
  for i in range(len(S)):
    if S[i]!=1:
      print(S[i])
      break

Submission status: Accepted

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

n = 0
for si in S:
    if si == '1':
        n += 1
    else:
        break

# if str(S)[0] == 1 and K == 1:
#     print(1)
# else:
#     print(str(S)[0])

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

Submission status: Accepted

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

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

Submission status: Accepted

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

for s in S :
    if s == '1' :
        K -= 1
    else :
        print(s)
        break
    
    if K == 0 :
        print(1)
        break

Submission status: Accepted

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

if S[0] == '1':
    counter = 1
    for s in S:
        if s != '1' or counter >= K:
            print(s)
            break
        counter += 1 
else:
    print(S[0])

Submission status: Accepted

Solution code:
S = str(input())
K = int(input())
for i,x in enumerate(S):
    if x=='1' and K<=i+1:
        print('1')
        break
    elif x!='1':
        print(x)
        break