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
n = int(input())
sequence = 0
digit = 0

while True:
    digit += 1
    a = 10**(digit-1)       # first digit of range
    b = int('9'*digit)      # last digit of range
    sequence = (b-a+1)*digit
    if n < sequence:        # if n current value is less than no of digit in this range 
        break
    else:                   # id n have more value than no of digit in this range
        n -= sequence

rem = n%digit     # (n-start+1) give sqeuence of req digit in range [start to end]
order = n//digit    # seq give no of place required digit have in this range

if rem != 0:        # to cal term by using AP 
    x = 1
else:
    x = 0
term = str( a + ( order + x -1) ) # a is first term is required range
print(term[rem-1])