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
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Sun Jun  2 15:30:47 2019

@author: ayushg1235
"""

#1234567891011121314151617181920...
from math import *

def digitcount(n):
    d = 0
    while(True):
        if pow(10,d) <= n < pow(10,d+1):
            return d+1
        else:
            d = d+1
            
def nth_digit(n):
    digitsum = 0
    i = 1
    while(True):
        digitsum += len(str(i))
        if digitsum >= n:
            return int(str(i)[-1-digitsum + n])
        else:
            i += 1
            
            
n1 = input()
n = int(n1)
print(nth_digit(n))






