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: Runtime Error

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

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

Submission status: Runtime Error

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

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


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

print(s[i+1])

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

Submission status: Runtime Error

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

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

# if len(s) == 1:
#     print(s)
#     exit()


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

Submission status: Runtime Error

Solution code:
// #define _GLIBCXX_DEBUG
#include <bits/stdc++.h>

#define FOR(i, a, b) for (int i = (a); i < int(b); ++i)
#define RFOR(i, a, b) for (int i = (b)-1; i >= int(a); --i)
#define REP(i, n) FOR(i, 0, n)
#define REP1(i, n) FOR(i, 1, int(n) + 1)
#define RREP(i, n) RFOR(i, 0, n)
#define RREP1(i, n) RFOR(i, 1, int(n) + 1)
#define ALL(c) begin(c), end(c)

int _ = (
#ifndef LOCAL
    std::cin.tie(nullptr), std::ios::sync_with_stdio(false),
#endif
    std::cout.precision(10), std::cout.setf(std::ios::fixed));

using ll = long long;
using ull = unsigned long long;
using ld = long double;
template <typename T> using vec = std::vector<T>;
using namespace std;

int main() {
  string S;
  ll K;
  cin >> S >> K;
  smatch m;
  regex_match(S, m, regex("^(1*)([1-9]*)$"));
  cout << ((m.length(1) >= K) ? '1' : m.str(2).front()) << endl;
  return 0;
}

Submission status: Runtime Error

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

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

print(1)

Submission status: Runtime Error

Solution code:
S = input()
K = int(input())
S = S.replace("1","")
print(S[0])

Submission status: Runtime Error

Solution code:
A = str(input())
B = int(input())
count = 0

for i in range(len(A)):
    if A[i] == "1":
        count += 1
    else:
        if B <= count:
            print(1)
            sys.exit()
        else:
            print(A[i])
            sys.exit()
print(1)

Submission status: Runtime Error

Solution code:
S=input()
K=int(input())
X=1
for i in range(10**5):
  if S[i]!=1:
    X=S[i]
      print(X)
      break

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
S = input()
K = int(input())
if S[0] == "1" and K == 1:
    print(1)
    exit()
A = S.lstrip("1")
print(A[0])

Submission status: Runtime Error

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

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

if judge != 0:
    print("1")

Submission status: Runtime Error

Solution code:
import sys
s = input()
n = int(input())
if n == 1:
	print(s[0])
	sys.exit()
if 
for i in s:
	if i != '1':
		print(i)
		sys.exit()
print(1)

Submission status: Runtime Error

Solution code:
S=list(input())
K=int(input())
a=b=0

for s in S:
	if s=='1':
		a+=1
	else:
		b=s
		break
if a>=K:
	print(i)
else:
	print(b)

Submission status: Runtime Error

Solution code:
S = input()
K = int(input())
for T in range(0,min(K,len(S))):
    if S[T]!='1':
        Disp = S[T]
        Flag = False
        break
if Flag: print('1')
else: print(Disp)

Submission status: Runtime Error

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

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
from collections import Counter
def main():
    s,k = input(), int(input())
    for i,v in enumerate(s):
        if v != '1':
            r = v
            break
    if k < i:
        print(1)
    else:
        print(r)

if __name__ == "__main__":
    main()

Submission status: Runtime Error

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

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
import math;
S=input();
K=input();
i = 0;
for i in range(len(S)) :
    if int(S[i]) > 1 :
        print(S[i]);
        break;
    elif i >= K :
        print(1);

Submission status: Runtime Error

Solution code:
s=list(map(int,tuple(input())))
k=int(input())
i=0
if 1 in s:
  i=s.index()
  if i+1>=k:
      print(1)
  else:
      print(s[i+1])
else:
  print(s[0])

Submission status: Runtime Error

Solution code:
def resolve():
    S = str(input())
    K = int(input())
    idx = S.find('1')

    if idx == -1:
        print(S[0])
        return
    else:
        if idx <= K:
            print(S[idx+1])
        else:
            print(S[0])
    return

resolve()

Submission status: Runtime Error

Solution code:
s=list(input())
k=int(input())
for i in range(100):
    if s[i]!="1":
        p=i+1
        pnum=int(s[i])
        break

if k<p:
    print(1)
else:
    print(pnum)

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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


if __name__ == "__main__":
    main()

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
S = input()
K = int(input())
last = "1"
for i,s in enumerate(S):
    if s != "1":
        last = s
        ind = i
        break
if K-1 < ind:
    print("1")
else:
    print(last)

Submission status: Runtime Error

Solution code:
s=list(input())
k=int(input())
mi=5*(10**14)
i=0
while k>=0:
  k-=s[i]*mi
  i+=1
print(s[i])

Submission status: Runtime Error

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


ind = 0
num = 1


for i in range(len(s)):
    ind = i+1
    if s[i] != 1:
        num = int(s[i])
        break
        
if k>= ind:
    ans = num
else:
    ans = 1
    
print(ans)

Submission status: Runtime Error

Solution code:
s=input()
k=int(input())
cnt=0
i=0
while s[i] =="1" and i<=len(s):
    cnt+=1
    i+=1

#print(cnt)
if k<=cnt:
    print(1)
else:
    #if len(s)==1:
        #print(s[0])
    #else:
    print(s[i])

Submission status: Runtime Error

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

Submission status: Runtime Error

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

for i in range(len(s)):
    if s[i] == 1:
        continue
    else:
        print(s[i])
        f = False
        break
if f:
    print(1)

Submission status: Runtime Error

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

for i in range(k):
    if s[i] == 1:
        continue
    else:
        print(s[i])
        f = False
        break
if f:
    print(1)

Submission status: Runtime Error

Solution code:
s=list(input())
k=int(input())
x=0
ans=0
while s[x]=="1":
  x+=1
if x>0:
  if k<=x:
    ans=1
  else:
    ans=s[x]
else:
  ans=s[0]

print(ans)

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
s = list(input())

k = int(input())

cnt = 0

if len(s) == 1:
    print(s[0])
else:
    if s[0] == "1":
        while s[0] == "1":
            cnt += 1
            del s[0]
        if cnt>=k:
            print(1)
        else:
            print(s[0])
            
    else:
        print(s[0])

Submission status: Runtime Error

Solution code:
s = list(input())

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

Submission status: Runtime Error

Solution code:
def examA():
    N = I()
    V = LI()
    C = LI()
    ans = 0
    for i in range(N):
        ans += max(0,V[i]-C[i])
    print(ans)
    return

def examB():
    S = SI()
    K = I()
    for s in S:
        if s!="1":
            ans = s
            break
    print(ans)
    return

def examC():
    ans = 0
    print(ans)
    return

def examD():
    ans = 0
    print(ans)
    return

def examE():
    ans = 0
    print(ans)
    return

def examF():
    ans = 0
    print(ans)
    return

from decimal import Decimal as dec
import sys,bisect,itertools,heapq,math,random
from copy import deepcopy
from heapq import heappop,heappush,heapify
from collections import Counter,defaultdict,deque
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
def I(): return int(input())
def LI(): return list(map(int,sys.stdin.readline().split()))
def DI(): return dec(input())
def LDI(): return list(map(dec,sys.stdin.readline().split()))
def LSI(): return list(map(str,sys.stdin.readline().split()))
def LS(): return sys.stdin.readline().split()
def SI(): return sys.stdin.readline().strip()
global mod,mod2,inf,alphabet,_ep
mod = 10**9 + 7
mod2 = 998244353
inf = 10**18
_ep = 10**(-12)
alphabet = [chr(ord('a') + i) for i in range(26)]

sys.setrecursionlimit(10**7)

if __name__ == '__main__':
    examB()

"""
142
12 9 1445 0 1
asd dfg hj o o
aidn
"""

Submission status: Runtime Error

Solution code:
#include <bits/stdc++.h>
// #include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <math.h>
using namespace std;
typedef long long ll;

#define rep(i,n) for(int i=0;i<n;i++)
#define rep2(i,a,b) for(int i=(a);i<(b);i++)

template<class T> inline void chmin(T& a, T b) {if (a > b) a = b;}
template<class T> inline void chmax(T& a, T b) {if (a < b) a = b;}


int main() {
  string s;cin >> s;
  int k;cin >> k;
  rep(i,k+3){
    if (s[i]!='1'){
      cout<<s[i]<<endl;
      return 0;
    }
  }
  cout<<1<<endl;  
}

Submission status: Runtime Error

Solution code:
# For taking integer inputs.
import math


def inp():
    return(int(input()))


# For taking List inputs.
def inlist():
    return(list(map(int, input().split())))


# For taking string inputs. Actually it returns a List of Characters, instead of a string, which is easier to use in Python, because in Python, Strings are Immutable.
def instr():
    s = input()
    return(list(s[:len(s)]))


# For taking space seperated integer variable inputs.
def invr():
    return(map(int, input().split()))


a = input()
k = inp()
i = 0
while a[i] == '1':
    i += 1

if i >= k:
    print(1)
elif len(a) == i:
    print(1)
else:
    print(a[i])

Submission status: Runtime Error

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

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

Submission status: Runtime Error

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

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

Submission status: Runtime Error

Solution code:

S = list(map(int, input()))
K = int(input())
if S[0] == 1:
    print(S[1])
else:
    print(S[0])

Submission status: Runtime Error

Solution code:
s=list(input())
k=int(input())
ss=[]
t=5*(10**15)
for i in range(len(s)):
               ss.append(int(s[i]))
for i in range(len(s)):
  k-=ss[i]**t
  if k<ss[i+1]:
    print(ss[i+1])
    break
  elif k==0:
    print(ss[i])
    break

Submission status: Runtime Error

Solution code:
s=list(input())
k=int(input())
ss=[]
for i in range(len(s)):
               ss.append(int(s[i]))
for i in range(len(s)):
  k-=ss[i]*5*(10**15)
  if k<ss[i+1]:
    break
    
print(s[i+1])

Submission status: Runtime Error

Solution code:
s=list(int(input()))
k=int(input())
for i in range(len(s)):
  k-=s[i]*5(10**15)
  if k<s[i+1]:
    break
    
print(s[i+1])

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
s = input()
n = int(input())
i = 0
while s[i]=="1":
    if n==i:
        print(1)
        exit()
    i+=1

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

Submission status: Runtime Error

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

if s[0] == '1' and len(s) == 1:
  print(s[0])
elif s[0] == '1' and s[:k] == ['1']*k and len(s) != 1:
  print(s[1])
elif s[0] == '1' and s[1] != '1':
  print(s[1])
elif s[0]!='1':
  print(s[0])

Submission status: Runtime Error

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

if s[0] == '1' and len(s) == 1:
  print(s[0])
if s[0] == '1' and s[:k] == ['1']*k and len(s) != 1:
  print(s[1])
elif s[0]!='1':
  print(s[0])

Submission status: Runtime Error

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

if s[0] == '1' and len(s) == 1:
  print(s[0])
if s[0] == '1' and s[:k] == ['1']*k:
  print(s[1])
elif s[0]!='1':
  print(s[0])

Submission status: Runtime Error

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

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

Submission status: Runtime Error

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

for i in s:
  sumlen += int(i)**(5 * (10)**15)
  if sumtmp >= k:
    print(i)

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
#include <bits/stdc++.h>
using namespace std;

#define rep(i,s,n) for (int i = (int)s; i < (int)n; i++)
#define ll long long
#define ld long double
#define pb push_back
#define eb emplace_back
#define All(x) x.begin(), x.end()
#define Range(x, i, j) x.begin() + i, x.begin() + j
#define lbidx(x, y) lower_bound(x.begin(), x.end(), y) - x.begin()
#define ubidx(x, y) upper_bound(x.begin(), x.end(), y) - x.begin()
#define llbidx(x, y, z) lower_bound(x.begin(), x.end(), z) - lower_bound(x.begin(), x.end(), y) // 二要素間の距離
// #define M_PI 3.14159265358979323846 // CFでは定義しておく必要あり
#define deg2rad(deg) ((((double)deg)/((double)360)*2*M_PI))
#define rad2deg(rad) ((((double)rad)/(double)2/M_PI)*(double)360)
#define Find(set, element) set.find(element) != set.end()
#define Decimal(x) printf("%.10f\n", x) // 小数点を10桁まで表示
// debug用
#define PrintVec(x) for (auto elementPrintVec: x) { cout << elementPrintVec << " "; } cout << "\n";
#define debug(x) cerr << #x << ": " << (x) << "\n";
#define endl "\n"
// gcj print用
#define Case(x) printf("Case #%d: ", x);

typedef pair<int, int> PI;
typedef pair<ll, ll> PLL;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<vector<vector<int>>> vvvi;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef vector<vector<vector<int>>> vvvl;
typedef vector<PI> vpi;
typedef vector<vector<PI>> vvpi;
typedef vector<vector<vector<PI>>> vvvpi;
typedef vector<PLL> vpl;
typedef vector<vector<PLL>> vvpl;
typedef vector<vector<vector<PLL>>> vvvpl;

int POWINT(int x, int n) {
  int ret = 1;
  while (n > 0) {
    if (n & 1) ret *= x;
    x *= x;
    n >>= 1;
  }
  return ret;
};

ll POWLL(ll x, int n) {
  ll ret = 1;
  while (n > 0) {
    if (n & 1) ret *= x;
    x *= x;
    n >>= 1;
  }
  return ret;
};

template<class T>
inline bool chmax(T &a, T b) {
  if(a < b) {
    a = b;
    return true;
  }
  return false;
};

template<class T>
inline bool chmin(T &a, T b) {
  if(a > b) {
    a = b;
    return true;
  }
  return false;
};

void print() {
  cout << endl;
};

template <class T>
void print(vector<T> &vec) {
  for (auto& a : vec) {
    cout << a;
    if (&a != &vec.back()) cout << " ";
  }
  cout << endl;
};

template <class T>
void print(vector<T> &vec, ll k){
   ll n = vec.size();
   k = min(k, n);
   rep(i, 0, k-1) cout << vec[i] << " ";
   cout << vec[k-1] << endl;
};

template <class T>
void print(vector<vector<T>> &df) {
  for (auto& vec : df) {
    print(vec);
  }
};

template<class T, class U>
void print(pair<T,U> &p){
  cout << p.first << " " << p.second << "\n";
};

const ll LINF = 1e18+7;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);

  string s;
  cin >> s;
  ll k; cin >> k;

  ll tmp = LINF;
  char ch;
  for (ll i = 0; i < s.size(); i++) {
    if (s[i] != '1') {
      tmp = i;
      ch = s[i];
      break;
    }
  }

  if (tmp >= k) {
    cout << 1 << endl;
  } else {
    cout << ch << endl;
  }

  return 0;
};

Submission status: Runtime Error

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

#############
# Libraries #
#############

import sys
input = sys.stdin.readline

import math
#from math import gcd
import bisect
from collections import defaultdict
from collections import deque
from functools import lru_cache


#############
# Constants #
#############

MOD = 10**9+7
INF = float('inf')

#############
# Functions #
#############

######INPUT######
def I(): return int(input().strip())
def S(): return input().strip()
def IL(): return list(map(int,input().split()))
def SL(): return list(map(str,input().split()))
def ILs(n): return list(int(input()) for _ in range(n))
def SLs(n): return list(input().strip() for _ in range(n))
def ILL(n): return [list(map(int, input().split())) for _ in range(n)]
def SLL(n): return [list(map(str, input().split())) for _ in range(n)]

######OUTPUT######
def P(arg): print(arg); return
def Y(): print("Yes"); return
def N(): print("No"); return
def E(): exit()
def PE(arg): print(arg); exit()
def YE(): print("Yes"); exit()
def NE(): print("No"); exit()

#####Shorten#####
def DD(arg): return defaultdict(arg)


#####Inverse#####
def inv(n): return pow(n, MOD-2, MOD)

######Combination######
kaijo_memo = []
def kaijo(n):
  if(len(kaijo_memo) > n):
    return kaijo_memo[n]
  if(len(kaijo_memo) == 0):
    kaijo_memo.append(1)
  while(len(kaijo_memo) <= n):
    kaijo_memo.append(kaijo_memo[-1] * len(kaijo_memo) % MOD)
  return kaijo_memo[n]

gyaku_kaijo_memo = []
def gyaku_kaijo(n):
  if(len(gyaku_kaijo_memo) > n):
    return gyaku_kaijo_memo[n]
  if(len(gyaku_kaijo_memo) == 0):
    gyaku_kaijo_memo.append(1)
  while(len(gyaku_kaijo_memo) <= n):
    gyaku_kaijo_memo.append(gyaku_kaijo_memo[-1] * pow(len(gyaku_kaijo_memo),MOD-2,MOD) % MOD)
  return gyaku_kaijo_memo[n]

def nCr(n,r):
  if(n == r):
    return 1
  if(n < r or r < 0):
    return 0
  ret = 1
  ret = ret * kaijo(n) % MOD
  ret = ret * gyaku_kaijo(r) % MOD
  ret = ret * gyaku_kaijo(n-r) % MOD
  return ret

######Factorization######
def factorization(n):
  arr = []
  temp = n
  for i in range(2, int(-(-n**0.5//1))+1):
    if temp%i==0:
      cnt=0
      while temp%i==0: 
        cnt+=1 
        temp //= i
      arr.append([i, cnt])
  if temp!=1:
    arr.append([temp, 1])
  if arr==[]:
    arr.append([n, 1])
  return arr

#####MakeDivisors######
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

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

#####BitCount#####
def count_bit(n):
  count = 0
  while n:
    n &= n -1
    count += 1
  return count

#####ChangeBase#####
def base_10_to_n(X, n):
  if X//n:
    return base_10_to_n(X//n, n)+[X%n]
  return [X%n]

def base_n_to_10(X, n):
  return sum(int(str(X)[-i])*n**i for i in range(len(str(X))))

#####IntLog#####
def int_log(n, a):
  count = 0
  while n>=a:
    n //= a
    count += 1
  return count

#############
# Main Code #
#############

S = S()
K = I()
n = len(S)
ind = 0
for i in range(n):
  if S[i] != "1":
    ind = i
    num = S[i]
    break
if K>ind:
  P(num)
else:
  P(1)

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
s = list(input())

k = int(input())

p = -1
for i in range(len(s)):
  if s[i]!='1':
    p=i+1

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

Submission status: Runtime Error

Solution code:
s = input()
k = int(input())
if s[0] != "1":
  print(s[0])
  quit()
c = 0
while s[c] == "1":
  c += 1
if c < k:
  print(s[c])
else:
  print(s[k-1])

Submission status: Runtime Error

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

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
import numpy as np
S = np.array(list(map(str, input().rstrip())))
K = int(input())

cnt = 0

for i, s in enumerate(S):
    if s != "1":
        cnt = i+1
        ans = s
        break

if cnt > K:
    print(1)
else:
    print(int(ans))

Submission status: Runtime Error

Solution code:
import numpy as np
S = np.array(list(map(str, input().rstrip())))
K = int(input())

for i, s in enumerate(S):
    if s != "1":
        cnt = i+1
        ans = s
        break

if cnt > K:
    print(1)
else:
    print(int(s))

Submission status: Runtime Error

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

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

Submission status: Runtime Error

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

tmp = 0
for each in s:
  if each > 1:
    print(each)
    break
  tmp += 1
  if tmp == k:
    print(1)
    break

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
ans = 0
if int(str(S)[0]) == 1 and K == 1:
    ans = 1
elif int(str(S)[0]) != 1:
    ans = int(str(S)[0])
else:
    ans = int(str(S)[1])
print(ans)

Submission status: Runtime Error

Solution code:
import re
S=str(input())
k=int(input())
x=re.search(r'[2-9]',S).start()

if S[0]=='1':
  if k<=x:
    print(S[0])
  else:
    print(S[x])     
  
else:
  print(S[0])

Submission status: Runtime Error

Solution code:
import re
S=str(input())
k=int(input())
x=re.search(r'[2-9]',S).start()

if S[0]=='1':
  if k<=x:
    print(1)
  else:
    print(S[x])     
  
else:
  print(S[0])

Submission status: Runtime Error

Solution code:
# -*- coding: utf-8 -*-
"""
Created on Sat May  9 16:54:06 2020

@author: shinba
"""

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

cnt = 0

while s[cnt] == "1":
    cnt += 1

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

Submission status: Runtime Error

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

    cnt = 0
    while S[cnt]=='1' and cnt<len(S):
        cnt = cnt + 1
    
    if K<=cnt:
        print(S[0])
    elif cnt==len(S):
        print(S[cnt-1])
    else:
        print(S[cnt])


if __name__ == '__main__':
    main()

Submission status: Runtime Error

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

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


if __name__ == '__main__':
    main()

Submission status: Runtime Error

Solution code:

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

    cnt = 0
    while S[cnt]=='1':
        cnt = cnt + 1
    
    if K<=cnt:
        print(S[0])
    else:
        print(S[cnt+1])




if __name__ == '__main__':
    main()

Submission status: Runtime Error

Solution code:
def main():
    S  = input()
    K  = input()
    if K==1:
        print(S[0])
    elif S[0]=='1':
        print(S[1])
    else:
        print(S[0])



if __name__ == '__main__':
    main()

Submission status: Runtime Error

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


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

# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    S = int(next(tokens))  # type: int
    K = int(next(tokens))  # type: int
    print(solve(S, K))

def test():
    import doctest
    doctest.testmod()

if __name__ == '__main__':
    #test()
    main()

Submission status: Runtime Error

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

for i in range(min(N,K)):
    if S[i] != "1":
        print(S[i])
        quit()

print(1)

Submission status: Runtime Error

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

for i in range(min(N,K):
    if S[i] != "1":
        print(S[i])
        quit()

print(1)

Submission status: Runtime Error

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

ans = 1
index = 0
for j in range(len(S)):
    if S[j] != '1':
        ans = int(s[j])
        index = j
        break

if ans == 1:
    print(ans)
elif index < K-1:
    print(ans)
else:
    print(1)

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
import sys
input = sys.stdin.readline
S = list(map(int, list(input())[: -1]))
K = int(input())
x = 0
for i in range(len(S)):
  if S[i] == 1: x += 1
  else: break
if S[0] == 1:
  if K == x: print(1)
  else: print(S[x])
else: print(S[0])

Submission status: Runtime Error

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

notone = 101
for i, n in enumerate(s):
    if n != "1":
        notone = int(n)
        notonei = i
        break

if k < notonei:
    print(1)
else:
    print(notone)

Submission status: Runtime Error

Solution code:
import sys
import math

s=input()
k = int(input())
cnt = False
ans=0
for i in range(0,k+1):
    if s[i] != '1':
        ans = s[i]
        cnt = True
        break
    cnt+=1
if (not cnt):
    print(1)
else:
    print(ans)

Submission status: Runtime Error

Solution code:
import sys
import math

s=input()
k = int(input())
cnt = False
ans=0
for i in range(len(s),k):
    if s[i] != '1':
        ans = s[i]
        cnt = True
        break
    cnt+=1
if (not cnt):
    print(1)
else:
    print(ans)

Submission status: Runtime Error

Solution code:
a=int(input())
b=int(input())
hantei=0
if str(a)[0]=='1':
    for i in range(b):
        if str(a)[i]!='1':
            hantei=1
    if hantei==0:
        print('1')
    else:
        while 1:
            if str(a)[hantei]!='1':
                print(str(a)[hantei])
                break
            hantei+=1
else:
    print(str(a)[0])

Submission status: Runtime Error

Solution code:
a=int(input())
b=int(input())
hantei=0
if str(a)[0]=='1':
    for i in range(b):
        if str(a)[i]!='1':
            hantei=1
    if hantei==0:
        print('1')
    else:
        c=str(a)
        c=c.replace('1','')
        print(c[0])
else:
    print(str(a)[0])

Submission status: Runtime Error

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

one=0
i=0
#最初に連続する1の数を数える
while(s[i]=='1'):
    one+=1
    i+=1

if(k<=one):
    #kより1の数が多ければ1
    print(1)
else:
    #そうでない場合1の次に出てくる数字
    print(s[one])

Submission status: Runtime Error

Solution code:
a=int(input())
b=int(input())
if str(a)[0]=='1':
    if str(a)[b-1]=='1':
        print('1')
    else:
        c=str(a)
        c=c.replace('1','')
        print(c[0])
else:
    print(str(a)[0])

Submission status: Runtime Error

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

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