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

Submission status: Wrong Answer

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

for w in s:
    if w != 1:
        print(w)
        break

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
S = input()
K = int(input())
if K == 1 and S[0] == "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())
if K == 1 and S[0] == 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())
if K == 1 and S[0] == 1:
  print(1)
elif S[0] == 1:
  print(S[1])
else:
  print(S[0])

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

    after_S += days * math.log(n)
    if after_S >= math.log(K):
        print(n)
        break

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

t = 0
u = s[0]

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

ans = 1
for i in inp1:
    if i != '1':
        ans = int(i)
        break

print(ans)

Submission status: Wrong Answer

Solution code:

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

if flag==0:
    print(1)

Submission status: Wrong Answer

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

if flag==0:
    print(1)

Submission status: Wrong Answer

Solution code:

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

for i in (S):
    if int(i)!=1:
        print(i)
        break

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

for a in x:
    if a!="1":
        print(a)
        break
else :
    print(1)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

for i in s:
  if not i == '1':
    print(i)
    break
else:
  print(1)

Submission status: Wrong Answer

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

if k > len(s):
  for i in s:
    if not i == '1':
      print(i)
      break
  
elif len(s) >= k:

  for i in s:
    if not i == '1':
      print(i)
      break
  else:
    print(1)

Submission status: Wrong Answer

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

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

  for i in s:
    if not i == '1':
      print(i)
      break
  else:
    print(1)

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

Solution code:
"""
C - To Infinity
"""
s_list = input()
K = int(input())


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

Submission status: Wrong Answer

Solution code:
"""
C - To Infinity
"""
s_list = input()
K = int(input())

print(s_list[0])

Submission status: Wrong Answer

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

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

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

Submission status: Wrong Answer

Solution code:
S = list(input())
S = [int(i) for i in S]
K = int(input())-1
ans1 = 0
ans2 = 0
for i in range(K):
    if S[i] != 1:
        ans1 = i-1
        ans2 = S[i]
        break

if K <= ans1:
    print(1)
else:
    print(ans2)

Submission status: Wrong Answer

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

if int(S[0])==1 and K==1: print(S[0])
elif int(S[0])==1 and K>1: print(S[1])
else: print(S[0])

Submission status: Wrong Answer

Solution code:
if __name__ == '__main__':
    # AB = [int(i) for i in input().split()]
    S = str(input())
    K = int(input())
    for i in S:
        if i == str(K):
            print(i)
            break
        if i != '1':
            print(i)
            break

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
s = input()
k = int(input())
saf = []
for i in s:
  for j in range(int(i)**5000000000000000):
    saf.append(i)
    if len(saf) > k:
      break

print( "saf[k]")

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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


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

Submission status: Wrong Answer

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

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

    if n != "1":
        f = False
        print(n)
        break

Submission status: Wrong Answer

Solution code:
S = input()
K = input()
little_k = int(K[-3:])

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

Submission status: Wrong Answer

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

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

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

Submission status: Wrong Answer

Solution code:
#!/usr/bin/python3

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

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

Submission status: Wrong Answer

Solution code:
S=int(input())
num = []
num_count=0
while S != 0:
	num.append(S % 10)
	S = (S-S%10)/10
	num_count +=1
num.reverse()

K=int(input())

for i in range(num_count):
	if i<=K-1:
		if num[i] != 1:
			print(int(num[i]))
			break
else:
	print(1)

Submission status: Wrong Answer

Solution code:
S=int(input())
num = []
num_count=0
while S != 0:
	num.append(S % 10)
	S = (S-S%10)/10
	num_count +=1
num.reverse()

K=int(input())

for i in range(num_count):
	if i<=K:
		if num[i] != 1:
			print(int(num[i]))
			break
else:
	print(1)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
s = input()
for i in range(len(s)):
  if s[i] != 0:
    print(s[i])
    break

Submission status: Wrong Answer

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

l = [str(x) for x in S]
i = 0
while i <= s - 1:
  if l[i] == '1':
    i = i + 1
  else:
    break
if i == s:
  print(1)
else:
  print(l[i])

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

for c in S:
    if c != '1':
        print(c)
        quit()

print(1)

Submission status: Wrong Answer

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

for c in S:
    if c != '1':
        print(c)
        quit()

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

if len(S) == 1:
    print(S)
else:
    if K == 1:
        print(1)
    else:
        print(S[2])

Submission status: Wrong Answer

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

if len(S) == 1:
    print(S)
else:
    if K == 1:
        print(1)
    else:
        print(2)

Submission status: Wrong Answer

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

if len(S) == 1:
    print(S)
else:
    print(2)

Submission status: Wrong Answer

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

else:
    if S[0] != 1:
        ans = S[0]
    else:
        ans = S[1]

print(ans)

Submission status: Wrong Answer

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

count = 0

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

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

Solution code:
a=input()
b=int(input())-1
i=0
t=0
while t<0:
    if a[i]!='1':
        t=1
    else:
        i+=1
if i<b:
    print(a[i])
else:
    print('1')

Submission status: Wrong Answer

Solution code:
a=input()
b=int(input())
i=0
t=0
while t<0:
    if a[i]!='1':
        t=1
    else:
        i+=1
if i<=b:
    print(a[i])
else:
    print('1')

Submission status: Wrong Answer

Solution code:
a=input()
b=int(input())
i=0
t=0
while t<0:
    if a[i]!='1':
        t=1
    else:
        i+=1
if i<b:
    print(a[i])
else:
    print('1')

Submission status: Wrong Answer

Solution code:
a=input()
b=int(input())
if b==1:
    print(a[0])
elif a[0]=='1':
    print(a[1])
elif a[0]!='1':
    print(a[0])

Submission status: Wrong Answer

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


if __name__ == "__main__":
    main()

Submission status: Wrong Answer

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


if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
def main():
    S = [int(s) for s in list(input())]
    K = int(input())
    for i in S:
        if i != 1:
            print(i)
            break
    print(1)

if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
def main():
    S = [int(s) for s in list(input())]
    K = int(input())
    for i in S:
        if i != 1:
            print(i)
            break


if __name__ == "__main__":
    main()

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()
n = int(input())

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

Submission status: Wrong Answer

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

sz = len(s)

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
S = input()
K = int(input())
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())

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

Submission status: Wrong Answer

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

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

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

Solution code:
n = input()
m = input()

if n[0] == "1" and len(n) == 1:
	print(1)
elif n[0] == "1":
	print(n[1])
else:
	print(n[0])

Submission status: Wrong Answer

Solution code:
n = input()
m = input()

if n[0] == 1 and len(n) == 1:
	print(1)
elif n[0] == 1:
	print(n[1])
else:
	print(n[0])

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
a=input()
if a.count('1')==len(a):print(1)
else:print(a.replace('1','')[0])

Submission status: Wrong Answer

Solution code:
s=input()
k=int(input())-1
for i,num in enumerate(s):
    num=int(num)
    if num ==1:
        if i != k-1:
            continue
        print(1)
        break
    print(num)
    break

Submission status: Wrong Answer

Solution code:
import math
S = input()
K = int(input())
M = 5 * 10 ** 15

def main():
    sum = 0
    for s in S:
        n = int(s)
        sum += (M - 1) * math.log(n)
        if sum >= math.log(K):
            print(n)
            return

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:

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

slist = list(s)
i = 0
count = 0
while slist[i] == 1:
    count += 1
    
if count == 0:
    print(slist[0])
elif count >= k:
    print(1)
else:
    print(slist[i+1])

Submission status: Wrong Answer

Solution code:
#abc106c
import sys

s=raw_input()
k=int(raw_input())
if s.count('1')==len(s):
 print '1'
 sys.exit()
for i in xrange(k):
 if s[i]!='!':
  print s[i]
  sys.exit()

Submission status: Wrong Answer

Solution code:
#abc106c
import sys

s=raw_input()
k=int(raw_input())
if s.count('1')==len(s):
 print '1'
 sys.exit()
while s:
 if s[0]=='1':
  s=s[1:]
 else:
  print s[0]
  sys.exit()

Submission status: Wrong Answer

Solution code:
#abc106c
import sys

s=raw_input()
k=int(raw_input())
if s=='1':
 print '1'
 sys.exit()
while s:
 if s[0]!='1':
  print s[0]
  sys.exit()
 else:
  s=s[1:]
print '1'

Submission status: Wrong Answer

Solution code:
for i in list(input()):
  if i != "1":
    print(i)
    exit()
else:
  print(1)

Submission status: Wrong Answer

Solution code:
for i in list(input()):
  if i != "1":
    print(i)
    exit()

Submission status: Wrong Answer

Solution code:
s=input()
k=int(input())
minnum=1
maxnum=0
for num in s:
  num=int(num)
  minnum=1+maxnum
  maxnum=minnum+num
  if minnum<=k<=maxnum:
    print(num)
    break

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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


def ans():
    if len(S) == 1:
        return S
    else:
        for i in range(len(S)):
            if i + 1 == k:
                return 1
            if S[i] != '1':
                return S[i]
    
    return 1


print(ans())

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

cnt1 = 0
if s[0]==1:
    cnt1 += 1
    
for i in range(1, len(s)):
    if s[0] == 1 and s[i-1] == 1 and s[i] == s[i-1]:
        cnt1 += 1
        
if (s[0] != 1):
    print(s[0])
elif k <= cnt1:
    print(1)
else:
    print(s[cnt1])

Submission status: Wrong Answer

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

cnt1 = 0
if s[0]==1:
    cnt1 += 1
    
for i in range(1, len(s)):
    if s[0] == 1 and s[i-1] == 1 and s[i] == s[i-1]:
        cnt1 += 1
        
if k <= cnt1:
    print(1)
elif cnt1 == 0:
    print(s[0])
else:
    print(s[cnt1])

Submission status: Wrong Answer

Solution code:
def main():
    S = input()
    K = int(input())
    output = solve(S, K)
    print(output)
    return

def solve(S, K):
    if K <= len(S) and S[K-1] == "1":
        # 文字列の1番目からK番目までがすべて1だった場合、
        # 即ち、K番目の文字列が1である場合、
        # それ以降の文字列に1以外の数字があっても1が答え
        return "1"
    if not K == 1:
        for s in S:
            if not s == "1":
                return s  # Sの"1"ではない、最初の数字が答え
    return S[0]

if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
def main():
    S = input()
    K = int(input())
    output = solve(S, K)
    print(output)
    return

def solve(S, K):
    if K <= len(S) and S[K-1] == "1":
        # 文字列の1番目からK番目までがすべて1だった場合、
        # 即ち、K番目の文字列が1である場合、
        # それ以降の文字列に1以外の数字があっても1が答え
        return "1"
    if K == 1:
        for s in S:
            if not s == "1":
                return s  # Sの"1"ではない、最初の数字が答え
    return S[0]

if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
def main():
    S = input()
    K = int(input())
    output = solve(S, K)
    print(output)
    return

def solve(S, K):
    if K <= len(S) and S[K-1] == "1":
        # 文字列の1番目からK番目までがすべて1だった場合、
        # 即ち、K番目の文字列が1である場合、
        # それ以降の文字列に1以外の数字があっても1が答え
        return "1"
    for s in S:
        if not s == "1":
            return s  # Sの"1"ではない、最初の数字が答え

if __name__ == "__main__":
    main()

Submission status: Wrong Answer

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

if K == 1:
    print(S[0])
elif K >= 2:
    if S[0] != "1":
        print(S[0])
    else:
        i = 1
        while S[i] == "1" and len(S) - 2 >= i:
            i += 1
        print(S[i])

Submission status: Wrong Answer

Solution code:
def main():
    S = input()
    K = int(input())
    output = solve(S, K)
    print(output)
    return

def solve(S, K):
    if K <= len(S) and S[K-1] == "1":
        # 文字列の1からK番目までがすべて1だった場合、
        # それ以降の文字列に1以外の数字があっても1が答え
        return "1"
    for s in S:
        if s != "1":
            return s  # Sの"1"ではない、最初の数字が答え
    return "1"        # Sが全部1の場合は結果は1

if __name__ == "__main__":
    main()

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

first_not_one = -1

for i in range(len(S)) :
    if S[i] != "1" and S[i] != "0" :
        first_not_one = S[i]
        break
        
print(1 if first_not_one == -1 else first_not_one)

Submission status: Wrong Answer

Solution code:
def main():
    S = input()
    K = int(input())
    output = solve(S, K)
    print(output)
    return

def solve(S, K):
    if not K == 1:
        for s in S:
            if s != "1":
                return s  # Sの"1"ではない、最初の数字が答え
        return "1"        # Sが全部1の場合は結果は1
    return S[0]           # K が 1 の場合はS[0]

if __name__ == "__main__":
    main()

Submission status: Wrong Answer

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

first_not_one = -1

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

Submission status: Wrong Answer

Solution code:
def main():
    S = input()
    K = int(input())
    output = solve(S, K)
    print(output)
    return

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

if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
def main():
    S = input()
    K = int(input())
    output = solve(S, K)
    return output

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

if __name__ == "__main__":
    main()

Submission status: Wrong Answer

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

if K == 1:
    print(S[0])
elif K >= 2:
    if S[0:K].count("1") == K:
        print("1")
    else:
        print(S[S[0:K].count("1") - 1])

Submission status: Wrong Answer

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

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

print('1')

Submission status: Wrong Answer

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

S = "9999"
K = 1

ans = 1

for i in range(len(S)):
    if int(S[i]) == 1:
        pass
    else:
        ans = int(S[i])
        ones = i
        break

if not ones:
    ans = 1
elif K <= ones:
    ans = 1

print(ans)

Submission status: Wrong Answer

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

ans = 1

for i in S:
    if int(i) == 1:
        pass
    else:
        ans = int(i)

print(ans)

Submission status: Wrong Answer

Solution code:
# coding: utf-8

s,k = [ input() for i in range(2) ]

count = 0
while count != len(s) and s[count]=="1":
    count += 1

print(count)

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

Submission status: Wrong Answer

Solution code:
# coding: utf-8

s,k = [ input() for i in range(2) ]

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

if S[0] == 1 and S[1] == 1 and S[2] == 1 and S[3] == 1:
    print(1)
elif S[0] == 1 and S[1] == 1 and S[2] == 1:
    print(S[3])
elif S[0] == 1 and S[1] == 1:
    print(S[2])
elif S[0] == 1:
    print(S[1])
else:
    print(S[0])