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
def n_to_array(number):
    str_number = str(number)
    arr_number = []
    for digit in str_number:
        arr_number.append(int(digit))
    return arr_number


def n_digits(number):
    if number == 0:
        return 1
    n = 0
    while number > 0:
        n += 1
        number = number // 10
    return n


def _1177A(k):
    if k < 10:
        print(k)
        return
    k -= 9
    a = 10
    b = 99
    while (b - a + 1) * n_digits(a) < k:
        k -= (b - a + 1) * n_digits(a)
        a *= 10
        b *= 10
        b += 9
    nr = a + (k + n_digits(a) - 1) // n_digits(a) - 1
    ord = (k - 1) % n_digits(a)

    print(n_to_array(nr)[ord])


_1177A(int(input()))
