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 f(r, k, x):
    s = ''
    w = 10**(r-1)
    j = x
    while j <= k:
        s += str(w)
        w += 1
        j += r
    return s[k-x]

k = int(input())
if k <= 9:
    print(k)
elif 10 <= k <= 189:
    print(f(2, k, 10))
elif 190 <= k <= 2889:
    print(f(3, k, 190))
elif 2890 <= k <= 38889:
    print(f(4, k, 2890))
elif 38890 <= k <= 488889:
    print(f(5, k, 38890))
elif 488890 <= k <= 5888889:
    print(f(6, k, 488890))
elif 5888890 <= k <= 68888889:
    print(f(7, k, 5888890))
elif 68888890 <= k <= 788888889:
    print(f(8, k, 68888890))
elif 788888890 <= k <= 8888888889:
    print(f(9, k, 788888890))
elif 8888888890 <= k <= 98888888889:
    print(f(10, k, 8888888890))
else:
    print(f(11, k, 98888888890))