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:
s = input()
k = int(input())
s = s[:k]
for c in s:
    if c == '1':
        continue
    else:
        print(c)
        break
else:
    print(1)

Submission status: Accepted

Solution code:

s = input()
k = int(input())
flag = False

for i in range(len(s)):
    if s[i] != '1':
        if k > i:
            print(s[i])
        else:
            print(1)
        flag = True
        break
if flag is False:
    print(1)

Submission status: Accepted

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

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

print(ans)

Submission status: Accepted

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

"""
Sが2なら22,3なら333,4なら4444
nならstr(n)*n
5000兆日後のK文字目は何か

1234
1223334444
12222333333333444444444444444
i日後にはn^i増えてる

"""
# 頭が1
# どこまで1を持っているか調べておく
if S[0] == "1":
    for ind,s in enumerate(S):
        if s != "1":
            break
    ind += 1
    if K < ind:
        print(1)
    else:
        print(s)
else:
    print(S[0])

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

one = -1

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

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

Submission status: Accepted

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

for x in s:
  if x != '1':
    print(x)
    exit()
  else:
    count+=1
    if count >= k:
      print(1)
      exit()

Submission status: Accepted

Solution code:
s=input()
k=int(input())
i=0
for c in s:
    if c!="1":break
    i+=1
if k > i:print(c)
else:print("1")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
str = map(int,list(input()))
k = int (input())
counter = 1
for i in str :
  if i != 1 :
    ans = i
    break
  ans = 1
  if counter >= k:
      break
  counter += 1
print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

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

print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s=input()
k=int(input())
count=0
for i in s:
    if i=='1':
        count=count+1
    else:
        number=i
        break
if k<=count:
    print(1)
else:
    print(number)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def searchInf(s, k):
    l = k if len(s) >= k else len(s)
    for i in range(l):
        if s[i] == "1":
            continue
        else:
            print(s[i])
            return 0
    print(1)
    return 0


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

Submission status: Accepted

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

for i, c in enumerate(s):
    if c != '1':
        print(c)
        break

    if i == k - 1:
        print('1')
        break

Submission status: Accepted

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

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
s=input()
k=int(input())
i=0
for sk in s:
    if sk!="1":
        break
    i+=1
if k>i:
    print(sk)
else:
    print(1)

Submission status: Accepted

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-1])

Submission status: Accepted

Solution code:
S = input()
K = int(input())
judge = True
for i in range(len(S)):
    if S[i] !="1":
        # judge = False
        if (i+1) <= K: 
            print(S[i])
            exit()
print(1)

Submission status: Accepted

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

#最初何個1が続くか確かめる
cont1 = 0
lastdig = ""
for i in range(len(s)):
    if s[i] == "1":
        cont1+=1
    else:
        lastdig = s[i]
        break

if k<=cont1:
    print("1")
else:
    print(lastdig)

Submission status: Accepted

Solution code:
import numpy as np
from copy import deepcopy

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

if S[0] != '1': # 最初の文字が1以外の場合
  ans = S[0]
elif S == '1'*len(S): # 全ての文字が1の場合
  ans = '1'
else: # 1から始まる文字列で1以外の文字も含む場合
  n_1 = 0
  for i in range(len(S)):
    if S[i] == '1':
      n_1 += 1
    else:
      first_num = S[i]
      break
  if n_1 >= K:
    ans = '1'
  else:
    ans = first_num
    
print(ans)

Submission status: Accepted

Solution code:
#coding: utf-8
N = input()
K = int(input())
ans = 0
for i in range(min(K, len(N))):
    if int(N[i]) != 1:
        ans = N[i]
        #print(N[i])
        break
print(ans if ans != 0 else 1)

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
import sys
from math import *
from itertools import *
from collections import *
from functools import *
try:
    from math import gcd
except Exception:
    from fractions import gcd


def solve(S: int, K: int):
    ret = 1
    for i, s in enumerate(str(S)):
        if i == (K - 1):
            ret = s
            break
        if s != '1':
            ret = s
            break
    return ret


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

if __name__ == '__main__':
    main()

Submission status: Accepted

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

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

else:
    print("1")

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
#!/usr/bin/env python
S = input()
K = int(input())

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

Submission status: Accepted

Solution code:
#!/usr/bin/env python
S = input()
K = int(input())

if S[:K].count('1') == K:
    print('1')
else:
    for s in S:
        if not s == '1':
            print(s)
            break

Submission status: Accepted

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

cnt_1 = 0

for s in S:
    if s == '1':
        cnt_1 += 1
    else:
        break


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

Submission status: Accepted

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

print(ans)

Submission status: Accepted

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

S = input()
K = input()

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

Submission status: Accepted

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

S = input()
K = input()

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

Submission status: Accepted

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

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

Submission status: Accepted

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

x = 1

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

print(x)

Submission status: Accepted

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


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

Submission status: Accepted

Solution code:
S = input()
K = int(input())
if (K <= len(S)) :
    if (S[:K] == '1'*K) :
        print('1')
    else:
        for ch in list(S):
            if (ch != '1'):
                print(ch)
                break
else :
    for ch in list(S):
        if (ch != '1'):
            print(ch)
            break

Submission status: Accepted

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

Submission status: Accepted

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

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())
if K<=len(S) and S[:K]=="1"*K :
    print(1)
else:
    for i in range(K):
        if S[i]!="1":
            print(S[i])
            quit()

Submission status: Accepted

Solution code:
s=input()
k=int(input())
if len(s) >= k and sum(list(map(int, s[:k]))) == len(s[:k]):
    print(1)
    exit()
for si in s:
    if int(si) > 1:
        print(si)
        exit()

Submission status: Accepted

Solution code:
# coding: utf-8
# Your code here!
s = list(input())
K = int(input())
K -= 1
for i in range(int(len(s))):
    if int(i) == K:
        print(s[int(i)])
        break
    if s[int(i)] == '1': continue
    else:
        print(s[int(i)])
        break

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
input = sys.stdin.readline

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

flag = True
for i in range(k):
    if s[i] != '1':
        temp = s[i]
        flag = False
        break
if flag:
    print(1)
else:
    print(temp)

Submission status: Accepted

Solution code:
# -*- coding:utf-8 -*-

def solve():
    S = input()
    K = int(input())
    INF = 5000000000000000

    # num**INF はでかすぎる。無限長とみなしてOK

    now_k = 1
    for s in S:
        num = int(s)

        if now_k == K:
            print(num)
            return
        
        if num != 1:
            # 2以外なら、もうそれ。
            print(num)
            return
        
        now_k += 1
        



if __name__ == "__main__":
    solve()

Submission status: Accepted

Solution code:
s=input()
k=int(input())
ans=1
ans_c=0
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: Accepted

Solution code:

def main():
    data = list(map(int, list(input())))
    index = int(input())

    for i in range(index):
        if data[i] != 1:
            print(data[i])
            break
    else:
        print(data[i])



if __name__ == '__main__':
    main()

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:
s=input()
k=int(input())
if sum(list(map(int, s[:k]))) == len(s[:k]):
    print(1)
    exit()

for si in s:
    if si!='1':
        break

print(si)

Submission status: Accepted

Solution code:
S = input()
K = int(input()) -1
cnt = 0
ans = -1
while int(S[cnt]) == 1:
    if K == cnt:
        break
    cnt += 1
print(S[cnt])

Submission status: Accepted

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


def solve(S: int, K: int):
    for i in range(K):
        c = S[i]
        if c != '1':
            print(c)
            return
    print(1)
    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: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

for i, s in enumerate(S):
    if s != '1' and K-1 < i:
        ans = '1'
        break
    elif s != '1' and K-1 >= i:
        ans = s
        break
else:
    ans = '1'
print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def c():
    S = input()
    S = list(S)
    K = int(input())
    one = 0
    if K == 1:
        print(S[0])
        return 0
    else:
        for k in S:
            if k!="1":
                print(k)
                return 0
            else:
                one+=1
                if one == K:
                    print(1)
                    return 0
    print(1)
    return 0
if __name__ == '__main__':
    c()

Submission status: Accepted

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

Submission status: Accepted

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

for i in range(len(S)):
    if S[i] != '1':
        r = S[i]
        r_n = i
        break
else:
    print(1)
    exit()

if K <= r_n:
    print(1)

else:
    print(int(r))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
s = str(input())
k = int(input())
if len(set(s)) == 1 and "1" in s:
    print(1)
elif s.count("1") > k:
    print(1)
else:
    for i in range(len(s)):
        if s[i] != "1":
            print(s[i])
            break

Submission status: Accepted

Solution code:
s = int(input())
k = int(input())
S = str(s) #文字列にする

ans=0

for i in range(k):
  N = int(S[i])
  
  if N == 1:
    ans = 1
  else:
    ans = N
    break  
print(ans)

Submission status: Accepted

Solution code:
from sys import stdin
S = stdin.readline().rstrip()
K = int(stdin.readline().rstrip())
if set(S[:K]) == {'1'}:
    print(1)
else:
    for s in S:
        if s != '1':
            print(s)
            break

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

ans = "1"
for i in range(K):
    if i >= len(S):
        break

    if S[i] != "1":
        ans = S[i]
        break

print(ans)

Submission status: Accepted

Solution code:
if __name__ == '__main__':
    s = input()
    k = int(input())
    not_one = False
    for i in range(k):
        if s[i] != '1':
            print(s[i])
            not_one = True
            break

    if not not_one:
        print('1')

Submission status: Accepted

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


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

if K <= count1:
    print('1')
else:
    print(next_c)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
import sys
INF = float("inf")


def solve(S: str, K: int):

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

    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: str
    K = int(next(tokens))  # type: int
    solve(S, K)


if __name__ == '__main__':
    main()

Submission status: Accepted

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

c = 0
d = 1
for s in S:
  if s == '1':
    c += 1
  else:
    d = int(s)
    break

if c >= K:
  print(1)
else:
  print(d)

Submission status: Accepted

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

for s in S:
    if s == '1' and flag == True:
        count += 1
    else:
        flag = False

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

Submission status: Accepted

Solution code:
s=[int(i) for i in input()]
k=int(input())
#2^10^15=
a=0
for i in s:
  if i==1:
    a+=1
  else:
    break
if k<=a:
  print(1)
else:
  print(s[a])

Submission status: Accepted

Solution code:
S = [int(i) for i in input()]
K = int(input())
for num,i in enumerate(S):
    if i!=1:
        print(i)
        break
    else:
        if num==K-1:
            print(i)
            break

Submission status: Accepted

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

if S[0] != "1":
  print(S[0])
  exit()
  
else:
  index = 10**18+1
  for i in range(2,10):
    tmp = S.find(str(i))
    if 0< tmp < index:
      index = tmp
      ans = i
  if index <= K-1:
    print(ans)
  else:
    print(1)

Submission status: Accepted

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

oneRow = 0

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


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

Submission status: Accepted

Solution code:
import sys

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

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

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

Submission status: Accepted

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

if s[0] != '1':
    print(s[0])
else:
    len_1 = 0
    while True:
        if s == '1':
            len_1 = 1
            ans = 1
            break
        if s[0] == '1':
            s = s[1:]
            len_1 += 1
        elif s[0] != '1':
            ans = s[0]
            break
    if k > len_1:
        print(ans)
    else:
        print('1')

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
def main():
	S = input()
	K = int(input())
	# day = 5*(10**15)
	pos = 1
	for c in S:
		c_int = int(c)
		if c_int > 1:
			print(c)
			break
		if pos == K:
			print(c)
			break
		pos += 1



if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
def main():
	S = input()
	K = int(input())
	# day = 5*(10**15)
	pos = 1
	for c in S:
		c_int = int(c)
		if c_int > 1:
			print(c)
			break
		if pos == K:
			print(c)
			break
		pos += 1


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:

s = [int(i) for i in input()]
k = int(input())

count = 0
while s[0] == 1:
    s = s[1:]
    count += 1
    if len(s) == 0:
        break
if k <= count:
    print(1)
else:
    print(s[0])

Submission status: Accepted

Solution code:
def main():
  S = map(int,list(input()))
  K = int(input())
  for i,n in enumerate(S):
    if n == 1:
      K -= n
      continue
    if K>0:
      return n
    else:
      return 1
  return 1

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

Submission status: Accepted

Solution code:
numbers = input()
position = int(input())
answer = "1"
for num in numbers[:position]:
    if num != "1":
        answer = num
        break
print(answer)

Submission status: Accepted

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

while s[i] == "1":
	i += 1
	if i > len(s) - 1:
		break

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

Submission status: Accepted

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

count1 = 0
for i in S:
    if i == '1':
        count1 += 1
        if K == count1:
            print(i)
            quit()
    else:
        print(i)
        quit()

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
def solve(s, k):
    for i, d in enumerate(map(int, list(s))):
        if i == k-1:
            return s[k-1]
        if d > 1:
            return d
    return 1

s = input()
k = int(input())
print(solve(s, k))

Submission status: Accepted

Solution code:
import sys

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

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

print(s[k-1])

Submission status: Accepted

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

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

Submission status: Accepted

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

cnt_1 = 0
cnt_aft_1 = None

for s in S:
  if s == '1':
    cnt_1 += 1
  else:
    cnt_aft_1 = s
    break

if len(S) == 1:
  print(S)
elif int(K) <= cnt_1:
  print('1')
else:
  print(cnt_aft_1)

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
N=input()
K=int(input())
res=0
for i in range(K):
  if not N[i] == "1":
    print(N[i])
    break
  else:
    res+=1
if res == K:
  print(1)

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
import sys
import itertools
import collections
import functools
import math
from queue import Queue
# import numpy as np
INF = float("inf")


def solve(S: int, K: int):
    n = -1
    nc = 1
    for i, c in enumerate(str(S)):
        if c != "1":
            n = i+1
            nc = c
            break
    # print(n, nc, K)
    if n == -1:
        print(1)
        return

    if K < n:
        print(1)
    else:
        print(nc)

    return


def main():

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


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
S = str(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())
num=100000
for i in range(len(S)):
    if S[i]!="1":
        num=i
        T=int(S[i])
        break
if K-1<num:
    print(1)
else:
    print(T)

Submission status: Accepted

Solution code:
S = input()
K = int(input())
for i in range(K):
    if not S[i] == '1':
        print(S[i])
        exit()
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:
S = list(input())
K = int(input())

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

if((count == len(S))and(judge == 0)):
  ans = '1'
print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

a = 0
for si in s:
  if si != "1":
    print(si)
    break
  else:
    if k == 1:
      print(1)
      break
    else:
      k -= 1

Submission status: Accepted

Solution code:
S = input()
K = int(input())
for i in range(len(S)):
    if int(S[i]) > 1:
        p = i
        break
else:
    print(1)
    exit()
if K-1 < p:
    print(1)
else:
    print(S[p])

Submission status: Accepted

Solution code:
S = input()
K = int(input())
L = [int(i) for i in S]
count = 1
for i in L:
    if i != 1:
        if count <= K:
            print(i)
        else:
            print(1)
        exit()
    else:
        count += 1
print(1)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
s = list(map(int,list(input())))
k = int(input())

flag = 0

for i in range(len(s)):
    if flag == 0 and s[i] == 1:
        s[i] = 1
    elif flag == 0:
        s[i] = s[i]
        flag = s[i]
    else:
        s[i] = flag

if k > len(s):
    print(s[-1])
else:
    print(s[k-1])

Submission status: Accepted

Solution code:
S = input()
K = int(input())
index = len(S)-1
Num = 1
for i in range(len(S)):
  if not S[i] == '1':
    index = i+1
    Num = int(S[i])
    break
print(Num if K >= index else 1)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
import math
import fractions
from functools import reduce
from collections import Counter
sys.setrecursionlimit(10**7)
INF = 10 ** 18
MOD = 10 ** 9 + 7
def LI(): return [int(x) for x in sys.stdin.readline().split()]  # LIST INT
def LF(): return [float(x) for x in sys.stdin.readline().split()]  # LIST FLOAT
def LS(): return sys.stdin.readline().split()  # LIST STRING
def MI(): return map(int, sys.stdin.readline().split())  # MAP INT
def II(): return int(sys.stdin.readline())  # INPUT INT
def IS(): return input()  # INPUT STRING
def P(x): return print(x)
def C(x): return Counter(x)
def GCD_LIST(numbers):
    return reduce(fractions.gcd, numbers)


S = IS()
K = II()
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())

ans = ''
count = 0

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

if K <= count:
    ans = '1'


print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

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

print(res)