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
/**
 * @(#)DigitSequence.java
 *
 *
 * @author
 * @version 1.00 2019/6/1
 */
import java.io.*;
import java.util.*;
public class DigitSequence {

    /**
     * Creates a new instance of <code>DigitSequence</code>.
     */
    public DigitSequence() {
    }

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        Scanner in=new Scanner(System.in);
        int k=in.nextInt();
        int[] end=new int[5];
        end[0]=-1;
        for (int i=1; i<end.length; i++) {
        	end[i]=(i*(int)(Math.pow(10,i)));
        	end[i]-=(((int)(Math.pow(10,i))-1)/9);
        }
        //System.out.println(Arrays.toString(end));
        int st=0;//st=1 {0,9}; st=2 {10, 189}; st=3 {190-2889}; st=4 {2890-38889}
       	for (int i=1; i<end.length; i++) {
       		if (k>=end[i-1]+1 && k<=end[i]) st=i;
       	}
       	//System.out.println("st " + st);
       	int diff=k-end[st-1];
       	int mod=((diff+st-1)%st);
       	//System.out.println(mod);
       	int digit=-1;

       	int addOn=0;
       	if (mod==0) addOn=1;
       	if (mod==st-1) addOn=-1;
       	digit=(diff/(st*(int)(Math.pow(10,st-1-mod))));
       	digit+=addOn;
       	digit%=10;
       	System.out.println(digit);
       	//
    }
}
