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.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.math.BigInteger;
import java.util.AbstractList;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
import java.util.Queue;
import java.util.StringTokenizer;
import java.util.TreeMap;
import java.util.TreeSet;

public class Main {

    static int v, e; //vertices, arcos
    static int MAX = 100005;
    static ArrayList<Integer> ady[] = new ArrayList[MAX]; //lista de Adyacencia
    static int color[] = new int[MAX];
    static boolean bipartite;
    static boolean marked[] = new boolean[MAX]; //Estructura auxiliar para marcar los grafos visitados
    static long min = Long.MAX_VALUE;
    static int arr[] = new int[2];
//Recibe el nodo inicial s

    static int bfs(int s) {
        Queue<Integer> q = new LinkedList<Integer>();
        q.add(s);
        color[s] = 0;
//        System.out.println(color[s]);
        arr[color[s]]++;
//        System.out.println(color[s]+" "+arr[color[s]]);
        int actual, i, next;

        while (!q.isEmpty() && bipartite) {
            actual = q.poll();
            for (i = 0; i < ady[actual].size(); i++) {
                next = ady[actual].get(i);
                if (color[next] == -1) {
                    color[next] = 1 - color[actual];
//                    System.out.println(color[next]);
                    arr[color[next]]++;
//                    System.out.println(color[next]+" "+arr[color[next]]);
                    q.add(next);
                } else if (color[next] == color[actual]) {
                    bipartite = false;
                    return 0;
                }
            }
        }
//        System.out.println(arr[0]);
//        System.out.println(arr[1]);
        return Math.max(1, Math.min(arr[0], arr[1]));
    }

//    static void dfs(int s) {
//        marked[s] = true;
////        min = Math.min(arr[color[s]], min);
//        int i, next;
//
//        for (i = 0; i < ady[s].size(); i++) {
//            next = ady[s].get(i);
//            if (!marked[next]) {
//                arr[color[next]]++;
////                min = Math.min(arr[color[next]], min);
//                dfs(next);
//            }
//        }
//    }
    public static void main(String[] args) throws IOException {
        PrintWriter pw = new PrintWriter(System.out);
        Scanner sc = new Scanner();
        int n = Integer.parseInt(sc.next());
        StringBuilder s = new StringBuilder();
        for (int i = 1; i < 10000; i++) {
            s.append(i);
        }
        System.out.println(s.charAt(n-1));
    }

    static void init() {
        for (int i = 0; i < v; i++) {
            ady[i] = new ArrayList<Integer>();
        }
        for (int i = 0; i < MAX; i++) {	//inicializa la lista de adyacencia y el arreglo de marcados.
            ady[i] = new ArrayList<Integer>();
            marked[i] = false;

        }
    }

    static class Scanner {

        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        StringTokenizer st = new StringTokenizer("");
        int spaces = 0;

        public String nextLine() throws IOException {
            if (spaces-- > 0) {
                return "";
            } else if (st.hasMoreTokens()) {
                return new StringBuilder(st.nextToken("\n")).toString();
            }
            return br.readLine();
        }

        public String next() throws IOException {
            spaces = 0;
            while (!st.hasMoreTokens()) {
                st = new StringTokenizer(br.readLine());
            }
            return st.nextToken();
        }

        public boolean hasNext() throws IOException {
            while (!st.hasMoreTokens()) {
                String line = br.readLine();
                if (line == null) {
                    return false;
                }
                if (line.equals("")) {
                    spaces = Math.max(spaces, 0) + 1;
                }
                st = new StringTokenizer(line);
            }
            return true;
        }
    }
}
