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

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

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

Submission status: Accepted

Solution code:
import itertools
import math
import sys
from collections import Counter
from fractions import gcd
from functools import reduce

s = input()
k = int(input())
if k == 1:
    print(s[0])
else:
    flag = True
    for i in range(k):
        if s[i] != "1":
            flag = False
            break
    if flag:
        print("1")
    else:
        for i in s:
            if i != "1":
                print(i)
                break
        else:
            print(s[0])

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
S = str(input())
K = int(input())
count = 0
ans = 1
for i in S:
  if i == "1":
    count += 1
  else:
    ans = i
    break
if K <= count:
  print(1)
else:
  print(ans)

Submission status: Accepted

Solution code:
s = input()
k = int(input())
cnt = 0
ans = 1
for i in s:
    if i == "1":
        cnt += 1
    else:
        ans = i
        break

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

Submission status: Accepted

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

Submission status: Accepted

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

ones = 0
nzero = ""
for i in S:
    if i == "1":
        ones += 1
    else:
        nzero = i
        break

if K <= ones:
    print(1)
else:
    print(nzero)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s = input()
if set(s[:int(input())])=={'1'}:
  print(1)
else:
  for i in s:
    if int(i) > 1:
      print(int(i))
      break

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s = input()
k = int(input())
#5,000,000,000,000,000
count = 5000000000000000

lis = [int(s[i]) for i in range(len(s))]
for l in lis:
    if l == 1:
        if k > 1:
            k -= 1
            continue
        else:
            print(1)
            exit()
    else:
        print(l)
        exit()

Submission status: Accepted

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


char_sum = 0

for letter in S:
    n = int(letter)
    let_power = 1 if (n == 1) else float('inf')
    if (char_sum + let_power) >= K:
        print(letter)
        break
    else:
        char_sum += let_power

Submission status: Accepted

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

for i, v in enumerate(s):
  if i == k-1:
      print(v)
      exit()
  elif v != "1": 
      print(v)
      exit()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s = input()
k = int(input())
fl = True
for i in range(k):
    fl &= s[i] == "1"
    if not fl:
        print(s[i])
        break
else:
    print(1)

Submission status: Accepted

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

Submission status: Accepted

Solution code:


def resolve():
    s=input()
    K=int(input())
    for i in s:
        if i!='1':
            print(i)
            break
        else:
            if K==1:
                print(1)
                break
            K-=1
        



if __name__ == "__main__":
    resolve()

Submission status: Accepted

Solution code:
S = input()
K = int(input())
count = 0
for t in S:
  if int(t) == 1:
    count += 1
  else:
    break
if K <= count:
  print(1)
else:
  print(int(S[count]))

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
S = input()
K = int(input())
if len(S) >= K and S[K-1] == "1" and len(set(S[:K]))==1:
    print(1)
else:
    print([c for c in S if c != "1"][0])

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def main():
    string = input()
    index = int(input())
    for i in range(len(string)):
        if not string[i] == "1":
            if i > index - 1:
                print("1")
            else:
                print(string[i])
            break
    else:
        # string = "11111...111"のとき
        print("1")


if __name__ == '__main__':
    main()

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:
s, k = input(), int(input())
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())
kazu=5*10**5

for i in range(len(S)):
    if K<=int(S[i])**kazu:
        print(int(S[i]))
        break
    else:
        K=K-int(S[i])**kazu

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
s = input()
k = int(input())
idx = 1
for i in range(len(s)):
    if idx <= k:
        if int(s[i]) == 1: idx += 1
        else:
            print(s[i])
            exit()
    else: break
print(1)

Submission status: Accepted

Solution code:
S=input()
K=int(input())
a=[]
x=0
for i in range(2,10):
    x=S.find(str(i))
    if x!=-1:
        a.append(x)
    else:
        a.append(K)
m=min(a)
if m>K-1:
    print(1)
else:
    print(a.index(m)+2)

Submission status: Accepted

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

output = ''

if len(S) <= K:
    for letter in S:
        if letter != '1':
            output = letter
            break
else :
    for i in range(K):
        if S[i] != '1':
            output = S[i]
            break

if output:
    print(output)
else :
    print('1')

Submission status: Accepted

Solution code:
N = int(input())
K = int(input())
n = N 
ans = n
c = 0
co = 0

while n > 10: #桁数を数える
    c = c + 1 
    n = n // 10
#print(c)
while c > -1: #上の桁から見ていく
    m = N // (10 ** c)
    d = m % 10
    #print(m)
    #print(d)
    if d == 1: # 1がどこまで連続しているかを調べる
        co = co + 1
    else:      #初めて1以外の数がでてきたらそれを一旦答えとする
        ans = d 
        break
    c = c - 1
if K <= co: #1が連続しているところを答える場合は答えは1
        ans = 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
    if i==K-1:
        print("1")

Submission status: Accepted

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

if len(S) > K:
    print(S[K-1])
else:
    num = '1'
    for s in S:
        if s != '1':
            num = s
            break
    print(num)

Submission status: Accepted

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

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

Submission status: Accepted

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

for i in range(k):
  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 k == 1:
    print(s[0])
    exit(0)

ans = '1'
for i, d in enumerate(s):
    if i == k:
        break

    if d != '1':
        ans = d
        break

print(ans)

Submission status: Accepted

Solution code:
#coding: utf-8
import math
import heapq
import bisect
import numpy as np
from collections import Counter
#from scipy.misc import comb

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

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

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

Submission status: Accepted

Solution code:
S = input()
K =int(input())
if K == S[:K].count("1"):
    print(1)
else:
    for c in S:
        if c != "1":
            print(c)
            break

Submission status: Accepted

Solution code:
s = input()
k = int(input())
front1 = 0
if s == "1":
  print(1)
  exit()
for i in range(len(s)):
  if s[i] == "1":
    front1 += 1
  else:
    break
print(s[min(k-1, front1)])

Submission status: Accepted

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

cnt = 0
for c in s:
    if c == '1':
        cnt += 1
    else:
        print(c)
        break

    if cnt >= k:
        print(c)
        break

Submission status: Accepted

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

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

print(ans)

Submission status: Accepted

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

ind = 0
for s in S:
    i = int(s)

    if i == 1:
        num = pow(i, 5000000000000000)
        if num + ind >= K:
            print(i)
            break
        else:
            ind += num
    else:
        print(i)
        break

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def solve(s, k):
    # 2^5000兆 >> 10^18 なので、sのk文字目までに1以外の数字xがあれば、k番目はxになる
    for i in range(min(k, len(s))):
        if s[i] != '1':
            return int(s[i])
    else:
        return 1

_s = input()
_k = int(input())
print(solve(_s, _k))

Submission status: Accepted

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

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:
s = input()
k = int(input())
count = 0
for i in range(len(s)):
    if s[i] != "1":
        count = i
        break
if k<count+1:
    print("1")
else:
    print(s[count])

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
import sys
import math
import os
import itertools

class cin():
    def int():
        return int(sys.stdin.readline().rstrip())
    def string():
        return sys.stdin.readline().rstrip()
    def mapInt():
        return [int(x) for x in cin.string().split()]
    def stringList(n):
        return [input() for i in range(n)]
    def intListList(n):
        return [cin.mapInt() for i in range(n)]

class Util():
    def roundUp(a,b):
        return -(-a // b)
    def toUpperMultiple(a,x):
        return Util.round_up(a,x) * x
    def toLowerMultiple(a,x):
        return (a // x) * x

S = cin.string()
K = cin.int()

def solve():
    for i,s in enumerate(S):
        if i == K:
            return "1"
        if s != "1":
            return s

    return "1"
print(solve())

Submission status: Accepted

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

c1 = False
for i in range(k):
   x = s[i]
   if (x == '1'):
      c1 = True

   else:
      print(x)
      exit()

if (c1):
   print('1')

Submission status: Accepted

Solution code:
s = input()
k = int(input())
import sys
for i,j in enumerate(s):
    if i > k-1:
        break
    if j != '1':
        print(j)
        sys.exit()
print(1)

Submission status: Accepted

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

for i in str(s):
    if i == '1':
        if k == 1:
            print(1)
            break
        else:
            k -= 1
    else:
        print(i)
        break

Submission status: Accepted

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

for _s in s:
    if _s == "1":
        if k == 1:
            print(1)
            break
        else:
            k -= 1
    else:
        print(_s)
        break

Submission status: Accepted

Solution code:
S =input()
K =int(input())
M = 0
for x in S:
    if x == "1":
        M+=1
    else:
        print(x)
        break
    if M == K:
        print(1)
        break

Submission status: Accepted

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

ans = 1

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

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 
if i == k-1:
    if s[k-1] != '1':
      exit()
    else:
      print(1)

Submission status: Accepted

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

T=5*(10**15)
t=0
for s in S:
    if(s=="1"):
        t+=1
        if(t==K):
            print(1)
            exit()
    else:
        print(s)
        exit()

Submission status: Accepted

Solution code:
import sys
 
stdin = sys.stdin
 
ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline().rstrip()
nas = lambda: stdin.readline().split()

s = ns()
k = ni()

c = 0
ans = 1
for i in range(len(s)):
    if s[i] == '1':
        c += 1
    else:
        if c >= k:
            break
        else:
            ans = s[i]
            break

print(ans)

Submission status: Accepted

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

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

Submission status: Accepted

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

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:
n = list(input())
k = int(input())
if len(n) == 1:
    print(int(n[0]))
    exit()
x = 0
for i in range(len(n)):
    if n[i] != "1":
        x = i
        break
if x+1 > k:
    print(1)
    exit()
else:
    print(n[x])

Submission status: Accepted

Solution code:
s = input()
n = len(s)
k = int(input())
ans = None
for i in range(k):
    if i == n:
        break

    if s[i] != '1':
        ans = int(s[i])
        break
    else:
        continue
if ans:
    print(ans)
else:
    print(1)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys

INPUT = lambda: sys.stdin.readline().rstrip()
INT = lambda: int(INPUT())

sys.setrecursionlimit(10 ** 9)


def main():
    S = INT()
    K = INT()

    for i, s in enumerate(str(S)):
        if int(s) != 1:
            if i >= K: print(1)
            else: print(s)
            break
    else:
        print(1)


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
s = input().strip()
k = int(input().strip())
days = 5 * (10 ** 15)
if len(s) == 1:
    print(s)
    exit()
before = 0
for i in range(0, len(s)):
    diff = 0
    if s[i] == "1":
        diff = 1
    else:
        for j in range(1, (days + 1), 1):
            if 10 ** 18 <= int(s[i]) ** j:
                diff = int(s[i]) ** j
                break
    if (k - 1) < (before + diff):
        print(s[i])
        break
    else:
        before = before + diff

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

def main():
    S = input().strip()
    K = int(input())
    
    for i, s in enumerate(S):
        if s != "1":
            print(s)
            exit()
        if i + 1 == K:
            print(s)
            exit()



if __name__ == '__main__':
    main()

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:
s = input()
k = int(input())
for i in range(k):
  if s[i] != "1":
    print(int(s[i]))
    exit()
print(1)

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())
if len(S) == 1:
    ans = int(S)
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())
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 s in S[:K]:
    if s != "1":
        print(s)
        break
else:
    print(S[K-1])

Submission status: Accepted

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

Submission status: Accepted

Solution code:
S = input()
K = int(input())
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())
if s=="1"*len(s):
  print(1)
else:
  i=0
  while True:
    if s[i]!="1":
      n=s[i]
      break
    else:
      i+=1
  if k-1<i:
    print(1)
  else:
    print(s[i])

Submission status: Accepted

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

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

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

Submission status: Accepted

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

li = [2,3,4,5,6,7,8,9]
ans = 1
for i in range(len(s)):
    if k == i+1:
        ans = s[i]
        break
    if s[i] in li:
        ans = s[i]
        break
print(ans)

Submission status: Accepted

Solution code:
import sys

s, k = sys.stdin.read().split()
k = int(k)
n = len(s)

def main():
    for i in range(1, n+1):
        if s[i-1] != '1':
            break
    
    return 1 if k < i else int(s[i-1])

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

Submission status: Accepted

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


main()

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
import bisect
import cmath
import heapq
import itertools
import math
import operator
import os
import re
import string
import sys
from collections import Counter, deque, defaultdict
from copy import deepcopy
from decimal import Decimal
from fractions import gcd
from functools import lru_cache, reduce
from operator import itemgetter, mul, add, xor

import numpy as np

if os.getenv("LOCAL"):
    sys.stdin = open("_in.txt", "r")

sys.setrecursionlimit(10 ** 9)
INF = float("inf")
IINF = 10 ** 18
MOD = 10 ** 9 + 7
# MOD = 998244353


S = sys.stdin.buffer.readline().decode().rstrip()
K = int(sys.stdin.buffer.readline())

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

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()
len_s=len(s)
cnt=0
k=int(input())
for v in s:
    if v!='1':
        print(int(v))
        break
    else:
        cnt+=1
        if k==cnt:
            print(1)
            break

Submission status: Accepted

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


ret = "1"
cnt = 0
f = True
for x in S:
    if f and x == "1":
        cnt += 1
    else:
        ret = x
        break

if cnt >= K:
    print("1")
else:
    print(ret)

Submission status: Accepted

Solution code:
s=input()
k=int(input())
ans,bns=0,0
for i in range(len(s)):
    if s[i]!="1":
        ans=s[i]
        break
    else:
        bns+=1 #0の連続
if k<=bns: #k=何番目
    print(1)
else:
    print(ans)

Submission status: Accepted

Solution code:
s=input()
k=int(input())
ans,bns=0,0
for i in range(len(s)):
    if s[i]!="1":
        ans=s[i]
        break
    else:
        bns+=1 #0の連続
if k<=bns: #k=何番目
    print(1)
else:
    print(ans)

Submission status: Accepted

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

for i in range(len(S)):
  if (S[i]=='1' and K-1==i) or S[i]!='1':
    print(S[i])
    exit()

Submission status: Accepted

Solution code:
numstr = input()
num = int(input())
def check():
    infinity = ""
    for i in range(num):
        if numstr[i] is not "1":
            infinity = infinity + numstr[i]
            return infinity
        else:
            infinity = infinity + "1"
    return "1"
infinity = check()
print(infinity[len(infinity)-1])

Submission status: Accepted

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

Submission status: Accepted

Solution code:
S = input()
K = int(input())
ans = 1
onecount = 0
for i in S:
    if i == "1":
        onecount += 1
        continue
    else:
        if onecount >= K:
            ans = 1
        else:
            ans = i
        break
print(ans)

Submission status: Accepted

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

try:
    if S[0:K] =='1'*K:
        print(1)
    else:
        S=list(S)
        print([i for i in S if i  != '1'][0])
except:
    if S[0:100] =='1'*100:
        print(1)
    else:
        S=list(S)
        print([i for i in S if i  != '1'][0])

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:
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:
s = list(str(input()))
k = int(input())

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

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

print(1)

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
s=input()
k=int(input())
place=101
ans=s[0]
for i in range(len(s)):
    if s[i]!='1':
        place=i+1
        ans=s[i]
        break
print(ans if place<=k else 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:
S = input()
K = int(input())
not_one = '1'
count = 0
for s in S:
  if s != '1':
    not_one = s
    break
  count += 1

if K <= count:
  print('1')
else:
  print(not_one)

Submission status: Accepted

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

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

print(ans)

Submission status: Accepted

Solution code:

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

s = str(S)
l = len(s)

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

print(1)

Submission status: Accepted

Solution code:

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

s = str(S)
l = len(s)

for i in range(K):
 if i>=len(s):
  print(s[-1])
  exit()
 if s[i] != '1':
  print(s[i])
  exit()

print(1)

Submission status: Accepted

Solution code:
from sys import exit

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


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

Submission status: Accepted

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

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

print(ans)

Submission status: Accepted

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

if k > 100:
    for i in s:
        if i != '1':
            print(i)
            exit()

elif k <= len(s):
    a = set(s[:k])
    if a == {'1'}:
        print(1)
        exit()
    else:
        for i in s:
            if i != '1':
                print(i)
                exit()
else:
    for i in s:
        if i != '1':
            print(i)
            exit()

Submission status: Accepted

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

Submission status: Accepted

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

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

if K <= count:
    ans = 1
else:
    ans = S[count]

print(ans)

Submission status: Accepted

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

flag = 0
for idx, s in enumerate(S):
    if idx == K-1 and s == "1":
        break
    if s == "1":
        continue
    else:
        flag = 1
        print(s)
        break
if flag == 0:
    print(1)

Submission status: Accepted

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

if li.count('1')==len(li):
    print(1)
else:
    for i in range(len(li)):
        if li[i]!='1' and i+1<=k:
            print(li[i])
            break
        elif li[i]!='1' and i+1>k:
            print(1)
            break

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s = input()
k = int(input())
d = 5 *  10**18

current = 0

for c in s:
    cint = int(c)
    if cint == 1:
        current += 1
    else:
        current += cint * d
    if current >= k:
        print (c)
        exit()

Submission status: Accepted

Solution code:
s = input()
k = int(input())
# 5千兆＝ 5 * 10**15
ans = '1'
for i in range(len(s)):
    if s[i] != '1' and i < k:
        ans = s[i]
        break
print(ans)

Submission status: Accepted

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

renzoku=0 #1が左端からどれだけ連続するか
for i in s:
  if i=="1":
    renzoku+=1
  else:
    break

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

Submission status: Accepted

Solution code:
s = [int(i) for i in input().strip()]
k = int(input())
ind = -1
while k > 0:
    ind += 1
    if s[ind] == 1:
        k -= 1
    else:
        k = 0
print(s[ind])

Submission status: Accepted

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

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

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

ans = s[0]

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

Submission status: Accepted

Solution code:
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,copy,functools
from collections import deque

sys.setrecursionlimit(10**7)
inf = 10**20
mod = 10**9 + 7

DR = [1, -1, 0, 0]
DC = [0, 0, 1, -1]

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()
     
def main():
    s = S()
    K = I()
    non_one = 0
    if K < len(s):
        print(s[K-1])
        return

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

    print(s[non_one])

main()

Submission status: Accepted

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

Submission status: Accepted

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

ans = S[0]

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

print(ans)

Submission status: Accepted

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