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.OutputStream;
import java.io.PrintWriter;
import java.math.BigInteger;
import java.util.*;


public class Main {

    public static void main(String[] args){
        Scanner sc =  new Scanner(System.in);
        OutputStream outputStream = System.out;
        PrintWriter out = new PrintWriter(outputStream);
/*
        int t = sc.nextInt();

        while(t-->0)
        {
            int n = sc.nextInt();

            String s = sc.next();
            char[] chars = s.toCharArray();
           // int[] a = new int[n];
            double count =0;

            for(int i=0;i<n;i++)
            {
                if(chars[i]=='A')
                {

                }//  a[i]=0;
                else
                {
                    count++;
                   // a[i]=1;
                }
            }
            double percent = 100*count/n;
            //System.out.println(percent);

            int moves =0;
            if(percent<75)
            {
                for(int i=2;i<n-2;i++)
                {

                    if(chars[i]=='A')
                    {
                        if(chars[i-1]=='P' ||chars[i-2]=='P' || chars[i+1]=='P' ||chars[i+2]=='P')
                        {
                          //  a[i]=1;
                            count++;
                            moves++;
                            percent = 100*count/n;
                            if(percent>=75)
                            {
                               // out.println(moves);
                                break;
                            }
                        }
                    }
                }


            }

            if(percent<75)
                out.println("-1");
            else
                out.println(moves);

        }

        String a ="9";
        String b = sc.next();

        BigInteger a1 = new BigInteger(a);
        BigInteger b1 = new BigInteger(b);
        b1 = b1.subtract(new BigInteger("1"));
        //out.println(b1);
        out.println(a1.multiply(b1).add(new BigInteger("19")));*/

        int k = sc.nextInt();
        String s = new String();

        for(int i=0;i<3000;i++)
        {
            s=s+i;
        }
        out.println(s.charAt(k));
        out.close();

    }

    static long  multiply(long n, long m)
    {
        long ans = 0, count = 0;
        while (m > 0)
        {
            // check for set bit and left
            // shift n, count times
            if (m % 2 == 1)
                ans += n << count;

            // increment of place
            // value (count)
            count++;
            m /= 2;
        }

        return ans;
    }

}
