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:
class Solver(object):
    def __init__(self):
        self.s = input()
        self.k = int(input())
        # self.compressed = self.to_compressed_format(self.s)

    def solve(self):
        for i in self.s:
            if int(i) != 1:
                print(i)
                return
        print(1)
        return

    def wrong_solve(self):
        print(self.compressed)
        counter = 0
        for (n, count) in self.compressed:
            print(n, count)
            counter += self.length_after(n, count)
            print("chk")
            if counter >= self.k:
                return n

    @staticmethod
    def length_after(n, count):
        return count * (n ** (5 * (10 ** 15)))

    @staticmethod
    def to_compressed_format(s):
        res = []
        counter = 1
        prev = int(s[0])
        for c in s[1:]:
            n = int(c)
            if n == prev:
                counter += 1
            else:
                res.append((prev, counter))
                prev = int(n)
                counter = 1
        res.append((prev, counter))
        return res


if __name__ == "__main__":
    s = Solver()
    s.solve()

Submission status: Wrong Answer

Solution code:
N=input()
for count in range(len(N)):  
    if N[count]!="1":    break
if int(input())>=count:    print(N[count])
else:    print(1)

Submission status: Wrong Answer

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

if len(s) == 1:
    print(s)
else:
    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 = int(input())

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

Submission status: Wrong Answer

Solution code:
def main(sbj:str,n:int):
    ans =sbj[0]
    if ans!="1":
        return int(ans)
    counter=1
    for i in range(len(sbj)-1):
        if sbj[i]==sbj[i+1]:
            counter += 1
        else:
            if n <=counter:
                return 1
            else:
                return int(sbj[i+1])
sbj = input()
n =int(input())
print(main(sbj,n))

Submission status: Wrong Answer

Solution code:
# https://qiita.com/_-_-_-_-_/items/34f933adc7be875e61d0
# abcde	s=input()	s='abcde'
# abcde	s=list(input())	s=['a', 'b', 'c', 'd', 'e']
# 5(1つだけ)	a=int(input())	a=5
# 1 2	| x,y = map(int,input().split())|	x=1,y=2
# 1 2 3 4 5 ... n 　	li = input().split()	li=['1','2','3',...,'n']
# 1 2 3 4 5 ... n 　	li = list(map(int,input().split()))	li=[1,2,3,4,5,...,n]
# FFFTFTTFF 　	li = input().split('T')	li=['FFF', 'F', '', 'FF']

# INPUT
# 3
# hoge
# foo
# bar
# ANSWER
# n=int(input())
# string_list=[input() for i in range(n)]

import collections
def inpl(): return list(map(int, input().split()))

#### START
S = input()
K = int(input())

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

if not f:
  print(1)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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

if S[0] == 1 and K == 1:
    print(1)
    sys.exit(0)
else:
    slist = list(S)
    while(len(slist) > 0):
        a = slist.pop(0)
        if a != '1':
            print(a)
            sys.exit(0)
print(1)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

D=5000000000000000

tmp=0
for s in S:
  tmp+=int(s)*D if s!='1' else 1
  if tmp>=K:
    print(s)
    break

Submission status: Wrong Answer

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

D=5000000000000000

tmp=0
for s in S:
  tmp+=int(s)*D if s!='1' else 1
  if tmp>K:
    print(s)
    break

Submission status: Wrong Answer

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

D=5000000000000000

tmp=0
for s in S:
  tmp+=int(s)*5000000000000000 if s!='1' else 1
  if tmp>K:
    print(s)

Submission status: Wrong Answer

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

for i in s:
    if int(i) > 1 and int(i) <= k:
        print(i)
        exit()
print(1)

Submission status: Wrong Answer

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

    for i in S:
        if i == 1:
            K -= 1
            continue
        j = 1
        while i < 5 * 10 ** 15:
            if i ** j >= K:
                print(i)
                exit()
            j += 1


main()

Submission status: Wrong Answer

Solution code:
# ABC 106
def db(x): 
    global debug
    if debug: print(x)
debug = False
S = input()
K = int(input())
c5000 = 5*10**15
k = 0
for i in range(len(S)):
    n = ord(S[i])-ord('0')
    if n>1: n *= c5000
    k += n
    db((i,k))
    if k>=K:
          print(S[i])
          break

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 int(S[i]) != 1 or K - i == 0:
      print(S[i])
      break

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

flag = 0

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

Submission status: Wrong Answer

Solution code:
S = input()
K = int(input())
cnt = 0
for x in S:
    if x == '1':
        cnt += 1
    break
#print(cnt)
if cnt < K:
    print(S[cnt])
else:
    print(1)

Submission status: Wrong Answer

Solution code:
S = input()
K = int(input())
cnt = 0
for x in S:
    if x == '1':
        cnt += 1
        break
#print(cnt)
if cnt < K:
    print(S[cnt])
else:
    print(1)

Submission status: Wrong Answer

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

sum=0
for i in range(0,len(S)):
    if(S[i]==1):
        sum+=1
    else:
        tmp=S[i]
        for j in range(2,5000000000000000):
            tmp*=S[i]
            if(sum+tmp>=K):
                print(S[i])
                exit()
            else:
                sum+=tmp

Submission status: Wrong Answer

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

sum=0
for i in range(0,len(S)):
    if(S[i]==1):
        sum+=1
    else:
        tmp=S[i]
        for j in range(2,5000000000000000):
            tmp*=S[i]
            print(tmp)
            if(sum+tmp>=K):
                print(S[i])
                exit()
            else:
                sum+=tmp

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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

for s in S:
	if s is not '1':
		print(s)
		break
else:
	print('1')

Submission status: Wrong Answer

Solution code:
S = input().rstrip()
input()
for s in S:
	if s is not '1':
		print(s)
		break
else:
	print('1')

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

for i, s in enumerate(S):
    if s == "1" and i < k:
        continue
    print(s)
    break
else:
    print(S[-1])

Submission status: Wrong Answer

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

for i, s in enumerate(S):
    if s == "1" and i < k:
        continue
    print(s)
    break

Submission status: Wrong Answer

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

default = '1'
last_one_index = 0
for i, c in enumerate(s):
    if c != '1':
        default = c
        last_one_index = i - 1
        break
if k <= last_one_index:
    print('1')
else:
    print(default)

Submission status: Wrong Answer

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


s = list(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:
inf = 5*10**15
S = input()
K = int(input())

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

Submission status: Wrong Answer

Solution code:
from sys import stdin
from math import log10

gosen = 5e15

S = int(stdin.readline().strip())
K = int(stdin.readline().strip())

logK = log10(K)
Sstr = str(S)

Kres = logK
for i in range(0, len(Sstr)):
    Si = int(Sstr[i])
    logNum = gosen * log10(Si)
    # if Si == 0:
    #     logNum = 1
    Kres = Kres - logNum
    if Kres <= 0:
        print(Si)
        break



# 2^gosen < K
# log(2^gosen) < log(K)
# gosen log(2) < log(K)

Submission status: Wrong Answer

Solution code:
from sys import stdin
from math import log10

gosen = 5e15

S = int(stdin.readline().strip())
K = int(stdin.readline().strip())

logK = log10(K)
Sstr = str(S)

Kres = logK
for i in range(0, len(Sstr)):
    Si = int(Sstr[i])
    logNum = gosen * log10(Si)
    if Si == 0:
        logNum = 1
    Kres = Kres - logNum
    if Kres <= 0:
        print(Si)
        break

Submission status: Wrong Answer

Solution code:
s=input()
k=int(input())
if s[0]=="1":
  try:
    if s[k-1]=="1":
      print('1')
    else:
      print(s[s.rfind("1")+1])
  except IndexError:
    try:
      print(s[s.rfind("1")+1])
    except IndexError:
      print(s[s.rfind("1")])
else:
  print(s[0])

Submission status: Wrong Answer

Solution code:
s=input()
k=int(input())
if s[0]=="1":
  try:
    if s[k-1]=="1":
      print('1')
    else:
      print(s[s.rfind("1")+1])
  except IndexError:
    try:
      print(s[s.rfind("1")+1])
    except IndexError:
      print(s[-1])
else:
  print(s[0])

Submission status: Wrong Answer

Solution code:
S = list(input())
k = int(input())
count = 0
ans = 0

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

if ans != 0:
    print(ans)
else:
    if count >= k:
        print('1')
    else:
        print('0')

Submission status: Wrong Answer

Solution code:
S = list(input())
k = int(input())
count = 0
ans = 0

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

if count > k:
    print('0')
elif count == k:
    print('1')
else:
    print(ans)

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

Solution code:
N = list(input())
k = input()

for i in N:
    if i == k:
        print(i)
        break
    elif i != '1':
        print(i)
        break

Submission status: Wrong Answer

Solution code:
N = list(input())
k = input()

for i in N:
    if i == k:
        print(i)
    elif i != '1':
        print(i)
        break

Submission status: Wrong Answer

Solution code:
a = input()
b = int(input())
br = []
if b == 1:
    print(a[0])
else:
    if len(set(list(a))) == 1 and "1" in a:
        print(1)
    else:
        for r in (list(a)):
            if r != "1":
                print(r)
                exit()

Submission status: Wrong Answer

Solution code:
S = input()
K = int(input())
counter = 1
num = 1
log = 0
for i in S:
    if int(i) != 1:
        log = counter
        num = int(i)
        break
    counter += 1

if K <= log:
    print(1)
else:
    print(num)

Submission status: Wrong Answer

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


x = "1"
for i in S:
	if i == "1":
		pass
	else:
		x = i
		break

if x != "1":
	if S.index(x) + 1 < K:
		print(x)
	else:
		print(1)
else:
	print(1)

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

Solution code:
import sys
# N,M = [int(n) for n in input().split()]
# S = str(input())
# T = str(input())
S = str(input())
K = int(input())

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

Submission status: Wrong Answer

Solution code:
import sys
# N,M = [int(n) for n in input().split()]
# S = str(input())
# T = str(input())

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

for i in range(len(S)):
    if (S[i] == "1"):
        numplace+=1
    else:
        numplace+= 5000000000000000*int(S[i])
    if(numplace>=K):
        print(S[i])
        sys.exit()

Submission status: Wrong Answer

Solution code:
s = input()
K = (int)(input())
k = K
for n in s:
  if k == 0:
    print(n)
  elif n == '1':
    k = k-1
  else:
    print(n)
if k == 0:
  print(s[K-1])

Submission status: Wrong Answer

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

for n in s:
  if k == 0:
    print(s[s.index(n)-1])
  elif n == '1':
    k = k-1
  else:
    print(n)

Submission status: Wrong Answer

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

for n in s:
  if k < 0:
    print(s[s.index(n)-1])
  elif n == '1':
    k = k-1
  else:
    print(n)

Submission status: Wrong Answer

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

if k <= 5000000000000000:
  for n in s:
    if k == 0:
      print(s[s.index(n)-1])
      break
    elif n == '1':
      k = k-1
    else:
      print(n)
      break

else:
  for n in s:
    if n == '1':
      k = k-1
    elif n == '2':
      if k <= 9460730472580800:
        print(n)
        break
    else:
      print(n)
      break

Submission status: Wrong Answer

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

if k <= 5000000000000000:
  for n in s:
    if k == 0:
      print(s[s.index(n)-1])
    elif n == '1':
      k = k-1
    else:
      print(n)

else:
  for n in s:
    if n == '1':
      k = k-1
    elif n == '2':
      if k >= 10**15:
        print()
      else:
        print(n)
    else:
      print(n)

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 = list(input())
k = int(input())
one_count = 0
stop_flag = 0

for i in s:
    if i != '1':
        print(i)
        stop_flag = 1
        break
    else:
        one_count += 1
        
if stop_flag == 0:
    if one_count >= k:
        print(1)
    else:
        print(0)

Submission status: Wrong Answer

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

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

if one_count >= K:
    print('1')
else:
    print('0')

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
    else:
        if i == len(S) - 1:
            print(S[i])

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
    else:
        if i == len(S) - 1:
            print(1)

Submission status: Wrong Answer

Solution code:
S = int(input())
K = int(input())
f = 0
ans = 10

list = [i for i in str(S)]
 
for i in list:
    if int(i) > 1:
        ans = min(ans,int(i))
        f = 1
        break

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

Submission status: Wrong Answer

Solution code:
S = input().rstrip()
K = int(input())
a = S[1] if K > 1 and S[0] == "1" and len(S) > 1 else S[0]
print(a)

Submission status: Wrong Answer

Solution code:
S = input().rstrip()
K = int(input())
a = S[1] if K > 1 and S[0] == "1" and len(S) > 1 else S[0]

Submission status: Wrong Answer

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

list = [i for i in str(S)]
list.sort()

if K <= len(list):
    if int(list[K-1]) == 1:
        ans = 1
else:
    for i in list:
        if int(i) > 1:
            ans = min(ans,int(i))

print(ans)

Submission status: Wrong Answer

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

list = [i for i in str(S)]
list.sort()

if K < len(list):
    if list[K-1] == 1:
        print(1)
else:
    for i in list:
        if int(i) > 1:
            ans = min(ans,int(i))

print(ans)

Submission status: Wrong Answer

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

	is_1 = True
	for i in range(K) :
		if (len(S) < i) :
			break

		# print("S[i] : " + S[i])
		if (S[i] != "1") :
			is_1 = False
			break

	if (is_1) :
		print("is_1 : True")
		print("1")
		return

	for i in range(len(S)) :
		if (S[i] == "1") :
			continue

		print(S[i])
		break


main()

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

if len(s)==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())
flag = True

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

if flag:
    print(1)

Submission status: Wrong Answer

Solution code:
S = input()
K = int(input())
array = []

for i in range(2, 10):
    if str(i) in S:
        if S.index(str(i)) <= K:
            array.append([S.index(str(i)), i])

if array:
    array.sort()
    print(array[0][1])
else:
    print(1)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
S = list(input())
K = int(input())
# 5000000000000000 = 5 * 10**15
S = [int(e) for e in set(S)]
number = 0
days = 5 * 10**15
for e in S:
    result = 1
    if e == 1:
        number += 1
        continue
    for f in range(1,days + 1):
        number = e**f
        if number >= K:
            print(e)
            exit()

Submission status: Wrong Answer

Solution code:
S = list(input())
K = int(input())
# 5000000000000000 = 5 * 10**15
S = [int(e) for e in set(S)]
number = 0
days = 5 * 10**15
for e in S:
    result = 1
    if e == 1:
        number += 1
        continue
    for f in range(days):
        initial = number
        result *= e
        number = initial + result
        if number >= K:
            print(e)
            exit()
        number = initial

Submission status: Wrong Answer

Solution code:
#coding:utf-8
n=input()
count=0
l=int(input())
for i in range(len(n)):
  if(n[i]=='1'):
    count+=1
    if(l<count):
      print(n[i])
      break;
    continue
  else:
    print(n[i])
    break;

Submission status: Wrong Answer

Solution code:
#coding:utf-8
n=input()
for i in range(len(n)):
  if(n[i]=='1' or n[i]==0):
    continue
  else:
    print(n[i])
    break;

Submission status: Wrong Answer

Solution code:
#coding:utf-8
n=input()
for i in range(len(n)):
  if(n[i]=='1'):
    continue
  else:
    print(n[i])
    break;

Submission status: Wrong Answer

Solution code:
import sys

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

for i in range(k):
    if i != 1:
        break
    elif i == k-1:
        print(1)
        sys.exit()

for i in s:
    if i != 1:
        print(i)
        sys.exit()

Submission status: Wrong Answer

Solution code:
import sys

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

def change(s):
    text = [i for i in s]
    after = []
    for t in text:
        if len(after) == 4:
            break
        for i in range(t):
            after.append(t)
            if len(after) == 4:
                break
    if text == after:
        print(after[-1])
        sys.exit()
    return after


while True:
    s = change(s)

Submission status: Wrong Answer

Solution code:
import itertools
s = input()
k = int(input())
g = itertools.groupby(s)
for a,b in g:
    v = len(list(b))
    break
if s[0]=='1':
    if k<=v:
        print(1)
    else:
        print(s[1])
else:
    print(s[0])

Submission status: Wrong Answer

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

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

if pos is None:
    print(1)
elif pos > K:
    print(1)
else:
    print(ans)

Submission status: Wrong Answer

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

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

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

Solution code:
days = 5000000000000000

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

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

print(str(s)[0])

Submission status: Wrong Answer

Solution code:
days = 5000000000000000

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

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

print(str(s)[0])

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
sS = input().rstrip()
iK = int(input())
if sS[0] == "1":
    if iK !=1:
        print(sS[1])
    else:
        print(sS[0])
else:
    print(sS[0])

Submission status: Wrong Answer

Solution code:
s=list(input())
k=int(input())
#print(s,k)
for i in s:
    if i=='1' and s.index(i)<k-1:
        continue
    elif i!=1 and s.index(i)<=k-1:
        print(i)
        break
    else:
        print(1)
        break

Submission status: Wrong Answer

Solution code:
s=list(input())
k=int(input())
#print(s,k)
for i in s:
    if i=='1' and s.index(i)<=k-1:
        continue
    elif i!=1 and s.index(i)<=k-1:
        print(i)
        break
    else:
        print(1)
        break

Submission status: Wrong Answer

Solution code:
s=list(input())
k=int(input())
#print(s,k)
for i in s:
    if i=='1' and s.index(i)<=k:
        continue
    elif i!=1 and s.index(i)<=k:
        print(i)
        break
    else:
        print(1)
        break

Submission status: Wrong Answer

Solution code:
s=list(input())
k=int(input())
#print(s,k)
if s[0]=='1' and k==1:
    print(s[0])
elif s[0]=='1' and k>=2:
    print(s[1])
else:
    print(s[0])

Submission status: Wrong Answer

Solution code:
s=list(input())
k=int(input())
#print(s,k)
if s[0]=='1' and k==1:
    print(1)
elif s[0]=='1' and k>=2:
    print(s[1])
else:
    print(s[0])

Submission status: Wrong Answer

Solution code:
s=list(input())
k=int(input())
#print(s,k)
if s[0]=='1' and k==1:
    print(1)
if s[0]=='1' and k>=2:
    print(s[1])
else:
    print(s[0])

Submission status: Wrong Answer

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

ans = 1

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

print(ans)

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])
        sys.exit(0)
    if(i+1==k):
        print(1)
        sys.exit()
print(1)

Submission status: Wrong Answer

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

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

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:
# coding: UTF-8
import sys
#sys.setrecursionlimit(n)
import heapq
import re
import bisect
import random
import math
import itertools
from collections import defaultdict, deque
from copy import deepcopy
from decimal import *

n = list(input())
for i in n:
    if i != '1':
        print(i)
        sys.exit()
print(1)

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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

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

Submission status: Wrong Answer

Solution code:
import math
from collections import deque

s = input()
k = int(input())
s_list = list(map(int, list(s)))

if len(s) == 1:
    print(int(s))
elif k == 1:
    print(s_list[0])
else:
    print(s_list[0])

Submission status: Wrong Answer

Solution code:
import math
from collections import deque

s = input()
k = int(input())
s_list = list(map(int, list(s)))

if len(s) == 1:
    print(int(s))
elif k == 1:
    print(s_list[0])
elif s_list[0] == 1:
    print(s_list[1])
else:
    print(s_list[0])

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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


print(m())

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
s = list(map(int,input().split()))
for i in s:
 if s != 1:
  print(i)
  break