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

Solution (Python):
import sys
import math
import collections
import itertools
import array
import inspect


sys.setrecursionlimit(10000)



def chkprint(*args):
    names = {
        id(v): k
        for k, v in inspect.currentframe().f_back.f_locals.items()
    }
    print(', '.join(
        names.get(id(arg), '???') + ' = ' + repr(arg) for arg in args))



def to_bin(x):
    return bin(x)[2:]


def li_input():
    return [int(_) for _ in input().split()]




dp = None


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

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

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

    i = 0
    while True:
        if S[i] != "1":
            print(S[i])
            return

        if i == K - 1:
            print(1)
            return

        i += 1


main()

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

Solution (Python):





S=input()
k=int(input())

c=0
l=0
for i in S:
    if i != "1":
        l=i
        break
    else:
        c+=1


if c>=k:
    print(1)
else:
    print(l)

Solution (Python):
S = input()
K = int(input())
c = 0
for k in range(len(S)):
    if S[k] != "1":
        c = k
        break
if K<=c:
    print(1)
else:
    print(S[c])

Solution (Python):
s=raw_input()
k=[int(k) for k in raw_input().split(" ")][0]


i=1

while k>1 and s[i-1]=='1' and i<len(s):
    i+=1
    k-=1

print s[i-1]

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

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

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

Solution (Python):
S=input()
K=int(input())
a=0
b=0
N=len(S)
for i in range(N):
    if S[i]=="1":
        a=i+1
    else:
        b=S[i]
        break
if K<=a:
    print(1)
else:
    print(b)

Solution (Python):
S = raw_input()
K = input()-1
for i in range(len(S)):
  if S[i]!="1":
    if i<=K:
      print S[i]
      break
else:
  print "1"

Solution (Python):
from collections import defaultdict,deque
import sys,heapq,bisect,math,itertools,string,queue,datetime
sys.setrecursionlimit(10**8)
INF = float('inf')
mod = 10**9+7
eps = 10**-7
def inpl(): return list(map(int, input().split()))
def inpl_s(): return list(input().split())

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

for i in range(K):
	if S[i] == '1':
		continue
	else:
		print(S[i])
		sys.exit()

print(S[K-1])

Solution (Python):
x=map(int,raw_input())
k=input()
if k<=len(x) and x[:k]==[1]*k:print 1
else:print [c for c in x if c!=1][0]

Solution (Python):
s = raw_input()
k = int(raw_input())

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

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

for c in S:
    if c == '1':
        if K == 1:
            print(1)
            break
        K -= 1
        continue
    print(c)
    break