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
k = int(input())
count = 1
number = 1
result = 0
number1 = 1
while True:
    if number == 1:
        if result + 9 < k:
            result += 9
            number = 20
            number1 = 10
        else:
            break
    elif number == 20:
        if result + 180 < k:
            result += 180
            number += 10
            number1 = 100
        else:
            break
    else:
        if result + 9 * number * 10**count < k:
            result += 9 * number * 10**count
            number += 10
            count += 1
            number1 *= 10
        else:
            break

while True:
    if count == 0:
        break
    if result + number * 10**count < k:
        result += number * 10**count
        number1 += 100 * 10**(count - 1)
    else:
        count -= 1

while True:
    if number == 1:
        break
    if result + number < k:
        result += number
        number1 += 10
    else:
        break

while True:
    if result + len(str(number1)) >= k:
        print(str(number1)[k - result - 1])
        break
    else:
        number1 += 1
        result += len(str(number1))
