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
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Scanner;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskB solver = new TaskB();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskB {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            long n = in.nextLong();
            long st = 1, en = n, ans = 0, len = 0;
            while (st <= en) {
                long mid = (st + en) / 2;
                long have = 0;
                int curLen = Long.toString(mid).length();
                long bef = 0;
                for (int i = 1; i < curLen; i++) {
                    long cur = 0;
                    for (int j = 1; j <= i; j++) {
                        cur *= 10;
                        cur += 9;
                    }
                    have += i * (cur - bef);
                    bef = cur;
                }
                have += curLen * (mid - bef);
                if (have < n) {
                    ans = mid;
                    len = have;
                    st = mid + 1;
                } else
                    en = mid - 1;
            }
            String s = Long.toString(ans + 1);
            for (int i = 0; i < s.length(); i++) {
                if (len + i + 1 == n) {
                    out.print(s.charAt(i));
                    return;
                }
            }
        }

    }
}

