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.util.*;

public class Main {


    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n=sc.nextInt();
        int d1=9,d2=90,d3=900;
        if(n<=9){
            System.out.println(n);
        }else if(n<=189){
            n=n-9;
            int r=n%2;
            if(r==0)
                System.out.println((9+n/2)%10);
            else
                System.out.println((10+n/2)/10);
        }else if(n<=2889){
            n=n-189;
            int r=n%3;
            n=n/3;
            if(r==0)
                System.out.println((99+n)%10);
            else if(r==1)
                System.out.println((n+100)/100);
            else if(r==2)
                System.out.println(((n+100)/10)%10);
        }else{
            n=n-2889;
            int r=n%4;
            n=n/4;
            if(r==0)
                System.out.println((999+n)%10);
            else if(r==1)
                System.out.println((n+1000)/1000);
            else if(r==2)
                System.out.println(((n+1000)/100)%10);
            else
                System.out.println(((n+1000)/10)%10);
        }

    }

}