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

public class Main
{  
    // static boolean isPanlindrome(int h, int m)
    // {
    //     if(h == 0 && m == 0) return true;
        
    //     String str1 = "", str2 = "";
    //     int cnt = 2;
    //     while(cnt-- > 0)
    //     {
    //         str1 += (char) (h%10 + '0');
    //         str2 += (char) (m%10 + '0');
    //         h /= 10;
    //         m /= 10;
    //     }
    //     if(str1.charAt(0) == str2.charAt(1) && str1.charAt(1) == str2.charAt(0)) return true;
    //     return false;
    // }
    
    public static void main(String[] args) throws IOException 
	{
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		StringTokenizer st = new StringTokenizer(br.readLine());
        int n = Integer.parseInt(st.nextToken()) - 1, num = 1;
        StringBuilder seq = new StringBuilder();
        while(seq.length() <= n)
        {
            seq.append(Integer.toString(num));
            num++;
        }
        //System.out.println(seq);
        System.out.println(seq.charAt(n));
    }

    static double getDistanceBetweenTwoPoints(int x1, int y1, int x2, int y2){
        return Math.sqrt(Math.pow(x2-x1,2) + Math.pow(y2-y1,2));
    }

    static int[] countLetterFreqeuncy(String str){
        int[] ltrs = new int[26];
        for(int i=0; i<str.length(); i++)
            ltrs[(int) (str.charAt(i) - 'A')]++;
        return ltrs;
    }
	
    static long gcd(long a, long b) { 
        if (a == 0) 
            return b;  
        return gcd(b % a, a);  
    } 
      
    static long lcm(long a, long b) { 
        return (a*b)/
        gcd(a, b); 
    } 

    // Arrays.sort(arr, new Comparator<Integer[]>() {
    //     @Override
    //             //arguments to this method represent the arrays to be sorted   
    //     public int compare(Integer[] arr1, Integer[] arr2) {
    //             //get the item ids which are at index 0 of the array
    //             Integer item1 = arr1[0];
    //             Integer item2 = arr2[0];
    //         // sort based on price
    //         return item1.compareTo(item2);
    //     }
    // });

    //String.join("", Collections.nCopies(n-1, "");
    
    //sort the String ArrayList (ignore the case)
    //Collections.sort(swStrArr, String.CASE_INSENSITIVE_ORDER);
    
    static int binarySearch(int left, int right, int find, int[] arr){
        int mid = left + (right-left)/2;
        if(find == arr[mid]) return mid;
        else if(find < arr[mid]) return binarySearch(left,mid-1,find,arr);
        else return binarySearch(mid+1,right,find,arr);
    }

    static ArrayList<Integer> separateDigits(int num){
         int pow = 0;
         ArrayList<Integer> arr = new ArrayList<>();
         while(num != 0)
         {
             if(num % 10 != 0)
             {
                 arr.add((num % 10) * (int) Math.pow(10, pow));
             }
             num /= 10;
             pow++;
         }
         return arr;
     }

    //Find pattern using multiplication
    // static int countNumOfPattern(char[][] matrix)
    // {
    //     //based on the size of pattern, nxm
    //     int cnt = 0;
    //     for(int i = 0; i<matrix.length; i++)
    //     {
    //         for(int j = 0; j<matrix[0].length; j++)
    //         {
    //             if(matrix[i][j] * matrix[i+1][j] * matrix[i][j+1] * matrix[i+1][j+1] == "The pattern")
    //                 cnt++;
    //         }
    //     }
    // }
    
    //Kadane’s Algorithm - find maximum subarray
    static int findMaxSubSum(int[] arr)
    {
        int crrMax = 0, fnlMax = 0;
        for(int i=0; i<arr.length; i++)
        {
            crrMax = Math.max(arr[i], arr[i] + crrMax);
            fnlMax = Math.max(crrMax, fnlMax);
        }
        return fnlMax;
    }
    
    
}
