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 A {
    static int[] a={9,189,2889,38889};
    static int[] b={0,9,99,999};
    public static void main(String[] args) {
        Scanner sc=new Scanner(System.in);
        int n=sc.nextInt();
        if(n<10){
            System.out.println(n);
        }else{
            int p=0,q=0;
            for(int i=1,j=10;i<4;i++,j*=10){
                if(n<=a[i]&&n>=a[i-1]){
                    p=a[i-1];
                    q=b[i];
                    break;
                }
            }
            int l=String.valueOf(q).length()+1,t=q+((n-p)%l==0?(n-p)/l:(n-p)/l+1),s=((n-p)%l==0?(n-p)/l-1:(n-p)/l);
            System.out.println(String.valueOf(t).charAt(n-(s*l+p)-1));
        }
    }
}
