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.*;
import java.lang.*;
public class Problem_1177_A{
	public static void main(String[] args) {
        Scanner sc=new Scanner(System.in);
        int ans,rem,temp;
        ans=rem=temp=0;
        int n=sc.nextInt();
        if(n<=9){
            System.out.println(n);
        }
        else{
            if(n>=10 && n<=189){
                ans=((n-9)/2);
                rem=((n-9)%2);
                ans=10+(ans-1+rem);
                if(n%2==1){
                    ans=ans%10;
                }
                else{
                    temp=ans%10;
                    ans=ans-temp;
                    ans=ans/10;
                }
                // System.out.println(ans);
            }

            else if(n>=190 && n<=2889){
                ans=((n-9-180)/3);
                rem=((n-9-180)%3);
                if(rem==2){
                    ans=100+(ans-2+rem);
                    ans=ans/10;
                    ans=ans%10;
                }
                else{
                    ans=100+(ans-1+rem);
                    if(rem==0){
                        ans=ans%100;
                        ans=ans%10;
                    }
                    else{
                        ans=ans/100;
                    }
                }
                // System.out.println(ans);
            }
            else{
                ans=((n-2889)/4);
                rem=((n-2889)%4);
                if(rem==2){
                    ans=1000+(ans-2+rem);
                    ans=ans/100;
                    ans=ans%10;
                }
                else if(rem==3){
                    ans=1000+(ans-3+rem);
                    ans=ans/10;
                    ans=ans%100;
                    ans=ans%10;
                }
                else{
                    ans=1000+(ans-1+rem);
                    if(rem==1){
                        ans=ans/1000;
                    }
                    else{
                        ans=ans%1000;
                        ans=ans%100;
                        ans=ans%10;
                    }
                }
            }
            System.out.println(ans);
        }
    }   
}