Let's write all the positive integer numbers one after another from 1 without any delimiters (i.e. as a single string). It will be the infinite sequence starting with 123456789101112131415161718192021222324252627282930313233343536...

Your task is to print the k-th digit of this sequence.

Input

The first and only line contains integer k (1 ≤ k ≤ 10000) — the position to process (1-based index).

Output

Print the k-th digit of the resulting infinite sequence.

Examples

Input


7


Output


7


Input


21


Output


5
###################### BLOCK 183 ########################
"""import math
lis=[]
def Sieve(n):
   prime = [True for i in range(n+1)] 
   p = 2
   while (p * p <= n):
      if (prime[p] == True):
         for i in range(p * p, n+1, p):
            prime[i] = False
      p += 1
    
   for p in range(2, n):
      if prime[p]:
         lis.append(p)
Sieve(3675788)
p=1009
q=3643
n=p*q
phi=(q-1)*(p-1)
for i in range(phi):
   if(i in lis):
"""     
################################ BLOCK problem 58 ####################
"""lis=[]
def Sieve(n):
   prime = [True for i in range(n+1)] 
   p = 2
   while (p * p <= n):
      if (prime[p] == True):
         for i in range(p * p, n+1, p):
            prime[i] = False
      p += 1
    
   for p in range(2, n):
      if prime[p]:
         lis.append(p)
Sieve(10**6)
def printSpiral(n):
   lis1=[]
   for i in range(0, n):
      for j in range(0, n):
# Finds minimum of four inputs 
         x = min(min(i, j), min(n-1-i, n-1-j))	     
# For upper right half 
         if(i <= j):
            lis1.append((n-2*x)*(n-2*x)-(i-x)-(j-x))
# For lower left half
         else:
            lis1.append((n-2*x-2)*(n-2*x-2)+(i-x)+(j-x))
      return lis1
def fun(n):
   l=printSpiral(n)
   lis3=[]
   for i in range(n):
      if(i==0):
         lis3.append(l[:n])
      else:
         lis3.append(l[n*i:n*i+n])
   count=0
   for i in range(n):
      for j in range(n):
         if((i==j or i+j==n-1) and (lis3[i][j] in lis)):
            count+=1
   if(count/(2*n-1) *100>10):
      return True
   return False
for i in range(4,10**6):
   if(fun(i)==True):
      print(i)
         
"""
######################## BLOCK PROBLEM 79 ############
"""import re
str = "The rain in Spain"
x = re.findall("[a-m]", str)
print(x)
"""
######################## BLOCK PROBLEM 378 ############
"""k=20
n=k*(k+1)
n//=2

lis=[0]*(n+1)
for i in range(1,n+1):
     for j in range(i,n+1,i):
          lis[j]+=1
l=[]
for i in range(1,k+1):
     l.append(lis[(i*(i+1))//2-1])
co=0
for i in range(1,len(l)):
     for j in range(i,len(l)):
          for k1 in range(j,len(l)):
               if(l[i]>l[j] and l[j]>l[k1]):
                    co+=1
                    print(l[i],l[j],l[k1])
print(co)
"""
######################## PROBLEM 345,401, #######################
"""n=10000000
sigma2=[0]*(n+1)
for i in range(1,n+1):
     for j in range(i,n+1,i):
          sigma2[j]+=i**2
print(sum(sigma2[1:n+1])%10**9)

import random
 def is_Prime(n):
    Miller-Rabin primality test.
 
    A return value of False means n is certainly not prime. A return value of
    True means n is very likely a prime.
    if n!=int(n):
        return False
    n=int(n)
    #Miller-Rabin test for prime
    if n==0 or n==1 or n==4 or n==6 or n==8 or n==9:
        return False
 
    if n==2 or n==3 or n==5 or n==7:
        return True
    s = 0
    d = n-1
    while d%2==0:
        d>>=1
        s+=1
    assert(2**s * d == n-1)
 
    def trial_composite(a):
        if pow(a, d, n) == 1:
            return False
        for i in range(s):
            if pow(a, 2**i * d, n) == n-1:
                return False
        return True  
 
    for i in range(8):#number of trials 
        a = random.randrange(2, n)
        if trial_composite(a):
            return False
 
    return True  

"""
############### pronlem 407##########
"""
import math
n=100
su=0
largestprime=[0]*(n+1)
largestprime[1]=1
for i in range(1,n+1):
     if(largestprime[i]==1):
          for j in range(i,n+1,i):
             largestprime[j]=i  
print(largestprime)
for i in range(1,n+1):
     if(largestprime[i]==i):
          su+=1
     else:
          su+=largestprime[i]
print(su)
"""
###################### PROBLEM 113 ###########
"""def bouncy(n):
     lis=[]
     while(n):
          lis.append(n%10)
          n//=10
     lis=list(reversed(lis))
     slis=list(sorted(lis))
     rlis=list(sorted(lis,reverse=True))
     if(lis==slis or lis==rlis):
          return False
     return True
n=10000
num=0
den=100
for i in range(101,n):
     #print(i,bouncy(i))
     if(bouncy(i)):
          num+=1
     den+=1
     if(num==den):
          print(i)
          break
print(num)
"""
######################## practice ########
"""
file=open("/Users/VS/Desktop/vij.txt","r")
lis=[]
for line in file:
     l=line.split(",")
     for i in l:
          lis.append(int(i))
print(lis)     
     
"""
############################ practise 145 ########
"""def odd_digit(n):
     while(n):
          x=n%10
          if(x%2==0):
               return False
          n//=10
     return True
n=1000000
lis=[]
for i in range(100000,100000+200):
     if(i not in lis and i%10!=0):
          a=int(''.join(reversed(str(i))))
          if(odd_digit(i+a)):
               print(i)
               lis.append(i)
               lis.append(a)
print(len(lis))
"""
############### PROBLEM 104 ##############
n=int(input())-1
x=1
y=9
while n>x*y:
     n-=x*y
     x+=1
     y*=10
a=str(10**(x-1)+n//x)[n%x]
print(int(a))
