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: Wrong Answer

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

count = 0
for i in a:
    if i != 1:
        print(i)
        exit()
print(1)

Submission status: Wrong Answer

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

count = 0
for i in a:
    if i != 1:
        print(i)
        break

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
S = input()
K = int(input())
S = sorted(set(S),key = S.index)
if S == ["1"]:
    print(S[0])
else:
    for i in range(len(S)):
        if S[i] != "1":
            print(S[i])
            break

Submission status: Wrong Answer

Solution code:
from sys import stdin

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

zantei = 1

for i in s:
    if i != "1":
        zantei = int(i)
        break

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

Submission status: Wrong Answer

Solution code:
# C - To Infinity
S = str(input())
K = int(input())
ans = 0
for i in range(len(S)):
    if S[i] == '1':
        ans = 1
    else:
        ans = S[i]
        print(ans)
        exit()
print(1)

Submission status: Wrong Answer

Solution code:
# C - To Infinity
S = str(input())
K = int(input())
ans = 0
for i in range(len(S)):
    if S[i] == 1:
        ans = 1
    else:
        ans = S[i]
        print(ans)
        exit()
print(1)

Submission status: Wrong Answer

Solution code:
# C - To Infinity
S = str(input())
K = int(input())
ans = 0

for i in range(len(S)):
    if S[i] == 1 and i < K:
        pass
    elif S[i] == 1 and i == K:
        print(1)
    else:
        ans = S[i]
        print(ans)
        exit()

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
S = list(input())
K = int(input())
for c in S:
    if c != "1":
        print(c)
        break
print("1")

Submission status: Wrong Answer

Solution code:
S = list(input())
K = int(input())
for c in S:
    if c != "1":
        print(c)
        break

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
s=input()
n=int(input())
ans=0
if n==1:
    print(s[0])
else:
    for c in s:
        if c=='1':
            if ans==0:
                ans=1

        else:
            ans=c
            break
print(ans)

Submission status: Wrong Answer

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

if n==1:
    print(s[0])

else:
    for c in s:
        if c=='1':
            continue
        else:
            print(c)
            break

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

for num in s:
  if(int(num) != 1):
    print(num)
    exit()
print(1)

Submission status: Wrong Answer

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

for num in s:
  if(int(num) != 1):
    print(num)
    exit()

Submission status: Wrong Answer

Solution code:
s=input()
k=int(input())
if k==1:print(s[0])
elif len(s)==1:print(s[0])
else:print(s[1] if s[0]=="1" else s[0])

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

cnt1 = 0
for i in range(len(s)):
  if s[i] == 1:
    cnt1 += 1

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

for s in S:
    if s != "1":
        print(s)
        break
else:
    print(1)

Submission status: Wrong Answer

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

con = 0

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

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

Submission status: Wrong Answer

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

con = 0

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

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
s = input()

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

print(S[1] if S[0] == '1' and K != 1 else S[0])

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

if s[0] == '1' and k == '1':
    print(1)
elif s[0] == '1':
    print(s[1])
else:
    print(s[0])

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

Solution code:

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

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


print(start)

Submission status: Wrong Answer

Solution code:

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

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

if K < pos+1:
    print(1)
else:
    print(start)

Submission status: Wrong Answer

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

# ===FUNCTION===

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

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

    return outputData

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

    return outputDataList

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

    return outputDataList

# ===CODE===

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

data = list(str(s))

# dataarray = np.zeros(len(data)) # 0で初期化

ans = 1

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

print(ans)

Submission status: Wrong Answer

Solution code:
# ABC106
S = input()
K = int(input())
i = 1
ans = int(S[0])
for s in S:
    if s == '1' and K == i:
        ans = 1
        break
    elif s != '1' and K != i:
        ans = int(s)
        break
    else:
        pass
    i += 1
print(ans)

Submission status: Wrong Answer

Solution code:
# ABC106
S = input()
K = int(input())
i = 1
for s in S:
    if s == '1' and K == i:
         print(1)
         break
    elif s != '1' and K != i:
        print(int(s))
        break
    else:
        pass
    i += 1

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
s=str(input())
k=int(input())
def solve(s,k):
  if k==1:
    return s[0]
  elif s[0]=='1':
    return s[1]
  else:
    return s[0]
print(solve(s,k))

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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: Wrong Answer

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

Submission status: Wrong Answer

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

if S[0] == '1':
    counter = 0
    for s in S:
        if s == '1' and counter < K:
            continue
        else:
            print(s)
            break
        counter += 1 
else:
    print(S[0])

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

Solution code:
# coding: utf-8
s = input()
k = int(input())


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

Submission status: Wrong Answer

Solution code:
# coding: utf-8
s = input()

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

Submission status: Wrong Answer

Solution code:
def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)
 
    return divisors


n = int(input())
ans = 0
if n < 105:
    print(0)
else:
    for i in range(105,n+2,2):
        m = make_divisors(i)
        if len(m) == 8:
            ans += 1

print(ans)

Submission status: Wrong Answer

Solution code:
S = str(input())
K = int(input())
N = len(S)
x = 1
i = 0
while int(x) == 1:
  x = S[i]
  #print(x)
  i += 1
  if (i == N) & (int(x) == 1):
    x = -1

x = int(x)    
if x == -1:
  print(1)
  quit()
else:
  i -= 1#while文を抜けるときに余計に+1されてるので、元に戻す
  
if i > K:
  print(1)
else:
  print(x)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

if "1" in n:
    one = n.rfind("1")-n.find("1")+1
    if one < k:
        print(n[n.find("1")+1])
    elif one >= k:
        print(1)
elif "1" not in n:
    print(n[0])

Submission status: Wrong Answer

Solution code:
print((input().replace("1","")+"1")[0])

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

Solution code:
# print('input >>')
S = input()
K = int(input())

if K == 1:
    ans = S[0]
else:
    if len(S) == 1 or not S[0] == '1':
        ans = S[0]
    else:
        ans = S[1]

# print('----------output----------')
print(ans)

Submission status: Wrong Answer

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

if s[0] != "1":
    print(int(s[0]))

elif s[0] == "1" and k != 1:
    if len(s) < k:
        for i in s:
            if int(i) != 1:
                print(int(i))

    else:
        for l in range(0, k):
            if int(s[l]) != 1:
                print(int(s[l]))
                break

            if l == k - 1:
                print(1)

elif s[0] == "1" and k == 1:
    print(1)

Submission status: Wrong Answer

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

if s[0] == "1" and k != 1:
    if len(s) < k:
        for i in s:
            if int(i) != 1:
                print(int(s[int(i)]))

    else:
        for l in s[0:k:]:
            if int(k) != 1:
                print(int(s[int(l)]))
                break

            if l == k - 1:
                print(1)

elif s[0] == "1" and k == 1:
    print(1)

Submission status: Wrong Answer

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

if s[0] == "1" and k != 1:
    print(s[1])

elif s[0] == "1" and k == 1:
    print(1)

else:
    print(s[0])

Submission status: Wrong Answer

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

if len(S) == 1:
    print(S)
else:
    h, n = int(S[0]), int(S[1])
    if h == 1:
        if K == 1:
            print(h)
        else:
            print(n)
    else:
        print(h)

Submission status: Wrong Answer

Solution code:
S = input().strip()
K = int(input())
cur = 0
a = 0
for i in range(len(S)):
    if S[i]!="1":
        a = S[i]
        break
    cur += 1
if K<cur:
    print("1")
else:
    print(a)

Submission status: Wrong Answer

Solution code:
S = input().strip()
K = int(input())
cur = 0
a = 0
for i in range(len(S)):
    if S[i]!="1":
        a = S[i]
        cur = i
        break
if K<cur:
    print("1")
else:
    print(a)

Submission status: Wrong Answer

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

S = S.strip('1')

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

Submission status: Wrong Answer

Solution code:
s=input()
lists=[int(integer)for integer in s] 
nums=int(input())

numbers=0 
strong=0 
#sに位置が初め何個ついているのかをnumbers変数に代入する
#もしｓが1で始まらなかった場合、その初めの文字を出力して終了する
for j in lists:
    if lists[0]!=1:
        break
    else:
        if j==1:
            numbers+=1
        else:
            break
#startで場合分け            
if lists[0]==1:
    if numbers>=nums:
        print(1)
        
    elif numbers<nums:
        print(lists[1])
else:
    print(lists[0])

Submission status: Wrong Answer

Solution code:
s=input()
lists=[int(integer)for integer in s] 
nums=int(input())

numbers=0 
strong=0 
for j in lists:
    if lists[0]!=1:
        print(lists[0])
        break
    else:

        if j==1:
            numbers+=1
        else:
            break
    if numbers>=nums:
        print(nums)
    else:
        print(lists[1])

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N = list(input())
K = int(input())
for i in N :
  a = int(i)
  if a!=1:
    print(a)
    exit()
print(1)

Submission status: Wrong Answer

Solution code:
N = list(input())
K = int(input())
for i in N :
  a = int(i)
  if a!=1:
    print(a)
    exit()
  else:
    if K==1:
      print(a)
      exit()

Submission status: Wrong Answer

Solution code:
N = list(input())
K = int(input())
for i in N :
  a = int(i)
  if a!=1:
    print(a)
    exit()

Submission status: Wrong Answer

Solution code:
S=list(str(input()))
k=int(input())
if k==1:
    print(S[0])
elif S.count('1')==len(S) and k!=1:
    print('1')
else:
    for i in range(k):
        if S[i]!='1':
            print(S[i])
            break

Submission status: Wrong Answer

Solution code:
S=list(str(input()))
k=int(input())
if k==1:
    print(S[0])
elif S.count('1')==len(S):
    print('1')
else:
    for i in range(k):
        if S[i]!='1':
            print(S[i])
            break

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
S=list(str(input()))
k=int(input())
if S.count('1')==len(S):
    print('1')
elif k==1 and S[0]==1:
    print('1')
else:
    for i in range(len(S)):
        if S[i]!='1':
            print(S[i])
            break

Submission status: Wrong Answer

Solution code:
S=list(str(input()))
k=int(input())
A=[]
for i in range(len(S)):
    si=int(S[i])
    ti=si**(k-1)
    while ti > 0:
        A.append(S[i])
        ti=ti-1
print("".join(A))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
s=input()
k=int(input())
for i in s[:k]:
    if i==1:continue
    else:print(i);exit()
print(1)

Submission status: Wrong Answer

Solution code:
s=input()
k=int(input())
for i in s:
    if i==1:continue
    else:print(i);exit()
print(1)

Submission status: Wrong Answer

Solution code:
s=input()
k=int(input())
for i in s:
    if i==1:continue
    else:print(i);exit()

Submission status: Wrong Answer

Solution code:
# ABC106 C - To Infinity
s = input()
k = int(input())

idx = 0
last = 0
a11_one = True

for i in range(len(s)):
    if s[i:i+1] == '1':
        idx = i
    else:
        last = s[i:i+1]
        a11_one = False
        break
if a11_one:
    print('1')
else:
    print('1' if k-1 <= idx else last)

Submission status: Wrong Answer

Solution code:
# ABC106 C - To Infinity
s = input()
k = int(input())

idx = 0
last = 0

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

Submission status: Wrong Answer

Solution code:
# ABC106 C - To Infinity
s = input()
k = int(input())

idx = 0
last = 0

for i in range(len(s)):
    if s[i:i+1] == '1':
        idx = i
    else:
        last = s[i:i+1]
        break
print(1 if k+1 <= idx else last)

Submission status: Wrong Answer

Solution code:
S = [int(s) for s in input()]
K = int(input())
if len(S) >= K and S[K-1] == 1:
    print(1)
else:    
    for k, s in enumerate(S, start=1):
        if s == 1:
            print(1)
            break
        else:
            print(s)
            break

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
S=list(input())
K=int(input())
for s in S:
  if int(s)!=1:
    break
print(s)

Submission status: Wrong Answer

Solution code:
n = input()
s = input()
if len(n) == 1:
  print(n)
else:
  if n[0] == "1":
    if s == "1":
      print(1)
    else:
      print(n[1])
  else:
    print(n[0])

Submission status: Wrong Answer

Solution code:
n = input()
s = input()
if s == n[0] == "1":
  print(1)
elif len(n)== 1:
  print(n)
elif n[0]== "1":
  print(n[1])
else:
  print(n[0])

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

if True:
    for i in S:
        if i != "1":
            print(i)
            sys.exit()
    print(i)

Submission status: Wrong Answer

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

if True:
    for i in S:
        if i != "1":
            print(i)
            sys.exit()
    print("1")

Submission status: Wrong Answer

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

if True:
    for i in S:
        if i != "1":
            print(i)
            sys.exit()
    print("1")

Submission status: Wrong Answer

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

if K <= 10 ** 16:
    for i in S:
        if i != "1":
            print(i)
            sys.exit()
    print("1")

else:
    is2 = False
    for i in S:
        if i == "2":
            if (is2):
                print("2")
                sys.exit()
            else:
                is2 = True
        elif i != "1" and i != "2":
            print(i)
            sys.exit()
    print("1")

Submission status: Wrong Answer

Solution code:
import sys

s = input()
k = int(input())
target = '1'

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

for c in s:
    if c != '1':
        target = c
        break

print(target)

Submission status: Wrong Answer

Solution code:
s = input()
k = int(input())
target = '1'

for c in s:
    if c != '1':
        target = c
        break

print(target)

Submission status: Wrong Answer

Solution code:
S = str(input())
K = int(input())
if S.count("1") == len(S):
    print(1)
    exit(0)
for s in S:
    if s != "1":
        print(s)
        exit()

Submission status: Wrong Answer

Solution code:
S = str(input())
K = int(input())
for s in S:
    if s != "1":
        print(s)
        exit()

Submission status: Wrong Answer

Solution code:
import os, sys, re, math

lines = sys.stdin.readlines()

S = lines[0]
K = lines[1]

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

Submission status: Wrong Answer

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

for i in S:
  if i != S[0]:
    print(i)
    exit()
    
print(S[0])

Submission status: Wrong Answer

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

for i in S:
  if i != 1:
    print(i)
    exit()
    
print(S[0])

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

Solution code:
S = input()
K = input()
for c in S:
    if(c != '1'):
        print(c)
        break 
else:
    print('1')

Submission status: Wrong Answer

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

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

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

Submission status: Wrong Answer

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

def lcm(a, b):
    return a * b // gcd(a, b)

def combination_count(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

def permutations_count(n, r):
    return math.factorial(n) // math.factorial(n - r)

big_prime = 1000000007

"""
# 標準入力取得
## 文字列
 =  sys.stdin.readline().rstrip()
 =  list(sys.stdin.readline().rstrip())

## 数値
 =  int(sys.stdin.readline())
 =  map(int, sys.stdin.readline().split())
 =  list(map(int, sys.stdin.readline().split()))
 =  [list(map(int,list(sys.stdin.readline().split()))) for i in range(N)]
"""


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

L = min(len(S), K + 1)
S = S[:L]

for s in S:
    if s != "1":
        print(s)
        exit()
print("1")

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
S = input()
K = input()
f = True
for s in S:
  if s != "1":
    print(s)
    f = False
    break
if f:
  print("1")

Submission status: Wrong Answer

Solution code:
S = input()
K = input()
f = True
for s in S:
  if s != "1":
    print(s)
    f = False
    break
if f:
  print(1)

Submission status: Wrong Answer

Solution code:
S = input()
K = input()
for s in S:
  if s != 1:
    print(s)
    break

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import sys
 
s=input()
k=int(input())
 
for i in range(len(s)):
  if s[i] != '1':
    print(s[i])
    break
  elif i == k - 1:
    break