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.Scanner;

public class Main {
    
public static void gDig(int k , int count)
{
    int res = 0;
    while(count != 0)
    {
        count--;
        res = k % 10;
        k /= 10;
    }
    System.out.println(res);
}
    
    public static void main(String[] args) {

        Scanner input = new Scanner(System.in);
        int k = input.nextInt();
        int tmp = 0;
        if(k < 10)
            System.out.println(k);
        
        else
        {
            //from 10 to 100
             if(k >=10 && k < 190)
             {
                k -= 9;
                tmp += k/2 + 9;
                
                if(k%2 == 0)
                    gDig(tmp , 1);
                
                else
                {
                    tmp++;
                    gDig(tmp , 2);
                }
             }
             //from 100 to 1000
             else if(k >= 190 && k < 2890)
             {
                 k -= 190;
                 tmp += k/3 + 100;
                 switch (k%3)
                 {
                     case 0:
                         gDig(tmp , 3);
                         break;
                     case 1:
                         gDig(tmp , 2);
                         break;
                     case 2:
                         gDig(tmp , 1);
                         break;
                     default:
                         break;
                 }
             }
             //from 1000 to 9999
             else if(k >= 2890 && k < 38890)
             {
                 k -= 2890;
                 tmp += k/4 + 1000;
                 switch (k%4)
                 {
                     case 0:
                         gDig(tmp , 4);
                         break;
                     case 1:
                         gDig(tmp , 3);
                         break;
                     case 2:
                         gDig(tmp , 2);
                         break;
                     case 3:
                         gDig(tmp , 1);
                         break;
                     default:
                         break;
                 }
             }
             else
             {
                 switch(k)
                 {
                     case 38890:
                         gDig(tmp , 5);
                         break;
                     case 38891:
                         gDig(tmp , 4);
                         break;
                     case 38892:
                         gDig(tmp , 3);
                         break;
                     case 38893:
                         gDig(tmp , 2);
                         break;
                     case 38894:
                         gDig(tmp , 1);
                         break;
                     default:
                         break;                 
                 }
             }
             
        }

    }

}
