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:
days = 5000000000000000

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Solution code:
S = 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:

sS = input().rstrip()
iK = int(input())

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
s=list(input())
k=int(input())
#print(s,k)
for i in range(len(s)):
    if s[i]=='1' and i<=k-2:
        continue
    elif s[i]=='1' and i==k-1:
        print(1)
        break
    elif s[i]!='1' :
        print(s[i])
        break

Submission status: Accepted

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

ans = 1

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

print(ans)

Submission status: Accepted

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

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
# coding: UTF-8
import sys
#sys.setrecursionlimit(n)
import heapq
import re
import bisect
import random
import math
import itertools
from collections import defaultdict, deque
from copy import deepcopy
from decimal import *

n = list(input())
k = int(input())
for i in range(k):
    if n[i] != '1':
        print(n[i])
        sys.exit()
print(1)

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
from collections import defaultdict, Counter
from itertools import product, groupby, count, permutations, combinations
from math import pi, sqrt
from collections import deque
from bisect import bisect, bisect_left, bisect_right
from string import ascii_lowercase
from functools import lru_cache
import sys
sys.setrecursionlimit(10000)
INF = float("inf")
YES, Yes, yes, NO, No, no = "YES", "Yes", "yes", "NO", "No", "no"
dy4, dx4 = [0, 1, 0, -1], [1, 0, -1, 0]
dy8, dx8 = [0, -1, 0, 1, 1, -1, -1, 1], [1, 0, -1, 0, 1, 1, -1, -1]


def inside(y, x, H, W):
    return 0 <= y < H and 0 <= x < W


def ceil(a, b):
    return (a + b - 1) // b


def main():
    S = input()
    K = int(input())
    if K == 1:
        print(S[0])
        return
    else:
        for i in range(min(len(S), K)):
            if S[i] != "1":
                print(S[i])
                return
    print(1)


if __name__ == '__main__':
    main()

Submission status: Accepted

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

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
a=input()
b=int(input())
s=0
for x in a:
    if x == "1":
        s += 1
    else :
        c=x
        break
if s >= b :
    print("1")
else:
    print(c)

Submission status: Accepted

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


one_idx = -1
next_char = "_"
for i, c in enumerate(S):
    if c == "1":
        one_idx = i
    else:
        next_char = c
        break


if (one_idx >= 0) and (one_idx >= K-1):
    print("1")
else:
    print(next_char)

Submission status: Accepted

Solution code:
a=input()
b=int(input())
s=0
for x in a:
    if x == "1":
        s += 1
    else :
        c=x
        break
if s >= b :
    print("1")
else:
    print(c)

Submission status: Accepted

Solution code:
S = input()
K = int(input())
count = 0
for i in range(len(S)):
    Snum = int(S[i])
    if Snum == 1:
        count += 1
        if count >= K:
            break
    else:
        wnum = 1
        for _ in range(K):
            if count + wnum >= K:
                break
            else:
                wnum = wnum*Snum
        else:
            continue
        break

print(str(Snum))

Submission status: Accepted

Solution code:
import math
s = list(map(int, list(input())))
k = int(input())
for i in range(len(s)):
    n = 5.0e+15 * math.log10(s[i])
    if n >= math.log10(k):
        print(s[i])
        exit()
    else:
        k -= 10**n

Submission status: Accepted

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

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def m():
    s = str(input())
    k = int(input())
    if len(s) >= k:
        for i in s[:k]:
            if i != "1":
                return i
        return 1
    else:
        for i in s:
            if i != "1":
                return i


print(m())

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

for w in s:
    if w == "1":
        k -= 1
        if k == 0:
            print(1)
            break
    else:
        print(int(w))
        break

Submission status: Accepted

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

if K >= len(S):
    K = len(S)

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

if flag:
    print('1')

Submission status: Accepted

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

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

if flag:
    print('1')

Submission status: Accepted

Solution code:
s = input()
k = int(input())
for c in s:
  if c == "1":
    k -= 1
    if k == 0:
      ans = 1
      break
  else:
    ans = c
    break
print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

i=0

while i <= k-1:
	if s[i] == 1:
		ans = 1
		i += 1
	else:
		ans = s[i]
		break

print(ans)

Submission status: Accepted

Solution code:
import math
S = list(map(int, input()))
K = int(input())
count = 0
after_S = 0
days = 5000000000000000-1
for n in S:
    if n == 1:
        count += 1
    else:
        break
if count > 0 and math.log(count) >= math.log(K):
    print(1)
else:
    for n in S:
        after_S += days * math.log(n)
        if after_S >= math.log(K):
            print(n)
            break

Submission status: Accepted

Solution code:
#!/usr/bin/env python
# -*- coding: utf-8 -*-

if __name__ == "__main__":
    S = list(map(int,list(input())))
    K = int(input())
    if 1 not in S:
        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, c in enumerate(S):
    if c != "1":
        print(c)
        exit(0)
    if i == K-1:
        print(1)
        exit(0)

Submission status: Accepted

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

while Slist[i]=='1' and K-1!=i:
    i+=1

ans=S[i]
print(ans)

Submission status: Accepted

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

t = 0
u = s[0]

for i in range(len(s)):
	t +=1
	u = s[i]
	if s[i] !="1":                 #この時点でｔはi+1になっている
		break
if t<k+1:
	print(u)
else:
	print(1)

Submission status: Accepted

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

t = 0
u = s[0]

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

Submission status: Accepted

Solution code:

S=raw_input()
K=int(raw_input())

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

Submission status: Accepted

Solution code:
s = list(map(int, list(input())))
k = int(input())
nums = 0
for i in s:
    if i > 1:
        print(i)
        break
    else:
        nums += 1
        if nums >= k:
            print(i)
            break

Submission status: Accepted

Solution code:
import sys

input = sys.stdin.readline
s = input()
k = int(input())
if len(s) == 1:
    print(s)
elif k == 1:
    print(s[0])
else:
    ans = '1'
    for i in range(min(len(s), k)):
        if s[i] != '1':
            ans = s[i]
            break
    print(ans)

Submission status: Accepted

Solution code:
list_s = list(str(input()))
k = int(input())
bord = 10 **9
for i in range(len(list_s)):
    if list_s[i] != "1":
        bord = i
        break
if k <= bord:
    print(1)
else:
    print(list_s[i])

Submission status: Accepted

Solution code:

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#
#	106 C - To Infinity
#

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

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

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

Submission status: Accepted

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

ans = 1
for si in list(s[:k]):
    if si != "1":
        ans = si
        break
print(ans)

Submission status: Accepted

Solution code:
S = input()
K = int(input())
i = 0
while i < len(S) and S[i] == "1":
    i += 1

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

Submission status: Accepted

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

if set(s[:k]) == set('1'):
	print(1)
else:
	for i in s:
		if i != '1':
			print(i)
			exit()

Submission status: Accepted

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

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

Submission status: Accepted

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

index =0
count =0
while index < len(s):
    spaceForChar = s[index]**50000
    newCount = count+ spaceForChar
    if count < k and k < newCount+1:
        print(s[index])
        break
    index+=1
    count = newCount

Submission status: Accepted

Solution code:
s = int(input())
l = [int(x) for x in list(str(s))]
k = int(input())
gosencho = 1

if k <= 100:
    for i in range(k):
        if l[i] != 1:
            gosencho = l[i]
            break
else:
    for i in range(len(l)):
        if l[i] != 1:
            gosencho = l[i]
            break

print(gosencho)

Submission status: Accepted

Solution code:
import sys
import math

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

for _, n in zip(range(K), S):
    if n != "1":
        print(n)
        sys.exit()

print("1")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
inp1 = input()
inp1 = list(inp1)
inp2 = input()
inp2 = int(inp2)

ans = 1
count = 0
for i in inp1:
    if i != '1':
        ans = int(i)
        break
    else:
        count += 1

if count >= inp2:
    ans = 1

print(ans)

Submission status: Accepted

Solution code:

S=input()
K=int(input())
flag=0
c=0
for i in (S):
    if int(i)!=1:
        print(i)
        flag=1
        break
    else:
        c+=1
        if c>=K:
            print(1)
            flag=1
            break

if flag==0:
    print(1)

Submission status: Accepted

Solution code:
x=input()
y=input()

for a in x:
    if a!="1" and int(x.index(a))<int(y):
        print(a)
        break
else:
    print(1)

Submission status: Accepted

Solution code:
x=input()
y=input()
x=list(x)

for a in x:
    if a!="1" and int(x.index(a))<int(y):
        print(a)
        break
else:
    print(1)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = list(str(input()))
k = int(input())
for i in range(min(k,len(n))):
  if n[i] != "1":
    print(n[i])
    exit()
print("1")

Submission status: Accepted

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

i = 0
while True:
    if S[i] == 1:
        k -= 1
        if k == 0:
            ans = 1
            break
        else:
            i += 1
    else:
        ans = S[i]
        break
print(ans)

Submission status: Accepted

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


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

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

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:
"""
C - To Infinity
"""
s_list = input()
K = int(input())


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

Submission status: Accepted

Solution code:
#coding:utf-8
s = input()
k = int(input())
idx = 1e+19
for i,char in enumerate(s):
    if int(char)>1:
        x = char
        idx = i
        break
#print (x,idx)
if k>idx:
    print (x)
else:
    print (1)

Submission status: Accepted

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


num = []
while n != 0:
  num.append(n % 10)
  n = n//10
num.reverse()

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

Submission status: Accepted

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

cur = 0
for s in S:
    if s > 1:
        print(s)
        break
    cur += 1
    if cur >= K:
        print(s)
        break

Submission status: Accepted

Solution code:
S = input()
K = int(input())
cnt = 0
for s in S:
  cnt += 1 if s == '1' else 10 ** 19
  if cnt >= K:
    print(s)
    break

Submission status: Accepted

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

Submission status: Accepted

Solution code:
S = list(input())
S = [int(i) for i in S]
K = int(input())
ans = 1

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

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

Submission status: Accepted

Solution code:
import sys


if __name__ == '__main__' :
    
    S = input()
    K = int(input())

    # Sが1で始まりかつKの長さがまで1が続くようであれば1
    for i in range(0,K):
        if S[i] == '1' and i < K:
            continue
        elif S[i] != '1':
            print(S[i])
            exit()
    print('1')

Submission status: Accepted

Solution code:
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(S[cnt])

Submission status: Accepted

Solution code:
s = input()
k  = int(input())
cnt = 0
for ss in s:
    if ss == '1':
        cnt += 1
        if k == cnt:
            print(1)
            break
    else:
        print(ss)
        break

Submission status: Accepted

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

thresh = K
if len(S) < K : thresh = len(S)

isOutput = False
for chr in S[:thresh]:
  if chr != '1':
    print(chr)
    isOutput = True
    break
  
if not isOutput:
  print("1")

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:
if __name__ == '__main__':
    # AB = [int(i) for i in input().split()]
    S = str(input())
    K = int(input())
    for n, i in enumerate(S):
        if n+1 == K:
            print(i)
            break
        if i != '1':
            print(i)
            break

Submission status: Accepted

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

Submission status: Accepted

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

	if s[0:min(k,101)] == "1" * min(k, 101):
		print(1)
	else:
		print(int(s.replace("1", "")[0]))
		

if __name__ == '__main__':
	main()

Submission status: Accepted

Solution code:
# coding: utf-8

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

not_one_index = 0
for i in range(len(s)):
    if s[i] == '1':
        not_one_index = not_one_index + 1
    else:
        break

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

Submission status: Accepted

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

Submission status: Accepted

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

num = 1
for i in range(1,101):    
	if s[i - 1] != '1':
		num = s[i - 1]
		break
        
	if i == k:
		break
    
print(num)

Submission status: Accepted

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

num = 1
for i in range(100):
    if i > k-1 : break

    if s[i] != '1':
        num = s[i]
        break

print(num)

Submission status: Accepted

Solution code:
s = raw_input()
k = input()
z = 0
ch = ''
for i in s:
	if i == '1':
		z += 1
		continue
	else:
		ch = i
		break
if k <= z:
	print "1"
else:
	print ch

Submission status: Accepted

Solution code:
def logic(S, K):
    if len(S) == 1:
        return int(S)
    if S[0:int(K)].replace("1","") == "":
        return 1
    a = S.replace("1", "")
    if len(a) == 0:
        return 1
    return int(a[0])


if __name__ == '__main__':
    print(logic(input(), input()))

Submission status: Accepted

Solution code:
from itertools import dropwhile, islice


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

    c = next(dropwhile(lambda c: c == '1', islice(s, k)), '1')
    print(c)


if __name__ == '__main__':
    main()

Submission status: Accepted

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

f = True
for i, n in enumerate(s):
    if n != "1":
        f = False
        print(n)
        break
    if i+1 == int(k) and f:
        print(1)
        break

Submission status: Accepted

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

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

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

Submission status: Accepted

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

index = 0
while s[index] == "1" and index < len(s) - 1:
    index += 1
if k <= index:
    print('1')
else:
    print(s[index])

Submission status: Accepted

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

for i, j in enumerate(s):
    if i + 1 >= k:
        print(j)
        exit()

    if j == "1":
        continue
        
    print(j)
    exit()

Submission status: Accepted

Solution code:
#!/usr/bin/python3

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

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

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

Submission status: Accepted

Solution code:
import math
S = input().split()[0]
K = int(input().split()[0])
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 in range(len(s)):
    if s[i]!="1":
        if i+1<=k:
            print(s[i])
            exit()

print(1)

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s = raw_input()
k = input()
index = -1
for i in xrange(len(s)):
	if s[i] > '1':
		index = i
		break
index += 1
if k >= index:
	print s[index-1]
else:
	print 1

Submission status: Accepted

Solution code:
S = input()
K = int(input())
s = len(str(S))
i=0

while i < s-1:
  if S[i] == '1':
    i = i + 1
  else:
    break

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

Submission status: Accepted

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

Submission status: Accepted

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

n = 0
for c in S:
  if c != "1": break
  n += 1

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

Submission status: Accepted

Solution code:
def main(st, k):
	num = 1
	st = str(st)
	for j in range(k):
		if st[j] != '1':
			num = int(st[j])
			break
	
	return num


st = input()
k =int(input())

print(main(st, k))

Submission status: Accepted

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

chrs = []
for ch in s:
  if int(ch) in {2,3,4,5,6,7,8,9}:
    chrs.append( (ch, 'Inf') )
  else:
    chrs.append( (ch, None) )

#print(chrs)

#で実数値がでるとき
#print( all(chrs[k2][1] is None for k2 in range(0,k)) )
if all(chrs[k2][1] is None for k2 in range(0,k)):
  print(1)
  sys.exit()
ret = None
for chr in chrs:
  if chr[1] == 'Inf':
    ret = chr[0]
    break

print(ret)

Submission status: Accepted

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

    if cnt == K:
        print(1)
        break

Submission status: Accepted

Solution code:
import sys


S = [int(_) for _ in list(input())]
K = int(input())
t = 0
while t <= len(S) - 1:
    if S[t] == 1:
        t += 1
    else:
        break

if K <= t:
    print(1)
    sys.exit()
else:
    print(S[t])
    sys.exit()

Submission status: Accepted

Solution code:
x=raw_input()
y=input()
n=0
for i in range(len(x)):
    n+=int(x[i])**(5*(10**5))
    if n>=y:
        print x[i] 
        break

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
S = [int(i) for i in input()]
K = int(input())
ans = 0
# 最初の2以上の添え字
idx = 101
for s in S:
    if s > 1:
        idx = S.index(s)
        break

# 2以上が無いなら、5000兆日後も変化なし
if idx == 101:
    ans = S[K - 1]

else:
    # 2以上があっても、添え字より前ならK出力
    if K - 1 < idx:
        ans = S[K - 1]
    else:
        ans = s

print(ans)

Submission status: Accepted

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

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

Submission status: Accepted

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

count = 0

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

if count >= K:
    print(1)
else:
    for i in range(K):
        if S[i] != '1':
            print(S[i])
            break
        elif S[i] == '1' and i == (K-1):
            print(1)

Submission status: Accepted

Solution code:
s = input()
k = int(input())
len1 = 0
e = "0"
for c in s:
  if c == "1":
    len1 += 1
  else:
    e = c
    break

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

Submission status: Accepted

Solution code:
S = input()
K = int(input())
def WhatNum(Str,k):
    if k == 1:
        return Str[0]
    if Str[0] != '1':
        return Str[0]
    else:
        return WhatNum(Str[1:],k-1)
print(WhatNum(S,K))

Submission status: Accepted

Solution code:
S = input()

K = int(input())

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

Submission status: Accepted

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

ones = 0
for st in S:
    if st != '1':
        break
    else:
        ones += 1

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

Submission status: Accepted

Solution code:
import sys
s = input()
k = int(input())
k = min(k,len(s))
i = 0
f = 0
while i < k:
  if int(s[i]) != 1:
    print(s[i])
    f = 1
    sys.exit()
  i += 1
if f == 0:
  print(1)

Submission status: Accepted

Solution code:
import sys
s = input()
k = int(input())
k = min(k,len(s))
i = 0
flag = 0
while i < k:
  if int(s[i]) != 1:
    print(s[i])
    flag = 1
    sys.exit()
  i += 1
if flag == 0:
  print(1)

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

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

Submission status: Accepted

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

sz = len(s)

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

S_list = list(map(int, list(S)))
i = 0
while True:
  if S_list[i] == 1:
    i += 1
    if K == i:
      print(S_list[i-1])
      break
  else:
    if K == 1:
      print(S_list[i])
      break
    else:
      print(S_list[i])
      break