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 DigitsSequence {
static int k;
static int c = 1;
public static void main(String args[])
     {     
  Scanner in = new Scanner(System.in);  
  k = in.nextInt();
  int i =0;
   while(c < k) {
  i ++;
  if (i>0&& i < 9){
  c = c + 1;
  } 
  
  if (i > 9 && i < 100) {
  c = c + 1;
  if (c == k){
  break;
  }else {c = c + 1;
  }
  }
  
  if (i >= 100 && i < 1000){
   c = c + 1;       
   if (c == k){
  break;
  }else if (c != k){
     c = c + 1;
  }if (c == k){
   break;
 } else {c =c +1;}       
  
 } if (i >= 1000 && i < 10000){
   c = c + 1;       
   if (c == k){
  break;
  }else if (c != k){
     c = c + 1;
  }if (c == k){
   break;}
  else if (c != k){
     c = c + 1;
  }if (c==k){
    break;
  }else {c = c + 1;}
  }}
     if (i <=10) {
     System.out.print((i % 10) + 1);}
     else if (c % 2 == 0 && i > 10 && i < 100){
     System.out.print(i / 10);}
     else if (c % 2 != 0 && i > 10 && i < 100){
         System.out.print(i % 10);}    
     else if (c >=190 && c <= 2889){
         c = c - 189;
       if (c % 3 == 1 ){
           System.out.print(i/100 );
       }if (c % 3 == 2 ){
          i = i %100;
       System.out.print(i/10);
       } else if (c % 3 == 0){
          i = i %100; 
         System.out.print(i % 10);   
         }
      }else {
       c = c - 2889;
       if (c % 4 == 1){
       System.out.print(i/1000);
       }else if (c % 4 == 2){
       i = i % 1000;
       System.out.print((i +1)/100);}
       else if (c % 4 == 3){
        i = i % 1000;
        i = i % 100;
        System.out.print(i/10);}
       else if (c % 4 == 0){
         i = i%1000;
         i = i%100;
         System.out.print(i % 10);   
       
       }
       }
       
       }
     }
    

     
     