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
/* package codechef; // don't place package name! */

import java.util.*;
import java.lang.*;
import java.io.*;

/* Name of the class has to be "Main" only if the class is public. */
public class Main
{
	public static void main (String[] args) throws java.lang.Exception
	{
	    int ans = 1;
		Scanner sc = new Scanner(System.in);
		int k = sc.nextInt();
		int flag = 0;
		int flag1 = 0;
		int flag2 = 0;
		int t = 1;
		for(int i=0;i<k;i++)
		{
		    if((t)/10 == 0)
		    {
		        ans = t%10;
		        t++;
		    }
		    else if(t/100 == 0)
		    {
		        if(flag==0)
		       {
		           ans = t/10;
		           flag = 1;
		       }
		        else
		        {
		            ans = t%10;
		            flag = 0;
		            t++;
		        }
		    }
		    else if(t/1000 == 0)
		    {
		        if(flag1 ==0)
		       {
		           ans = t/100;
		           flag1 = 1;
		       }
		        else if(flag1 == 1)
		        {
		            ans = t/10;
		            ans = ans%10;
		            flag1 = 2;
		         //   if(i==k-1)
		          //  System.out.println("-1");
		        }
		        else
		        {
		            ans = t%10;
		            flag1 = 0;
		            t++;
		        }
		    }
		    else
		    {
		        if(flag2 ==0)
		       {
		           ans = t/1000;
		           flag2 = 1;
		       }
		        else if(flag2 == 1)
		        {
		            ans = t/100;
		            ans = ans%10;
		            flag2 = 2;
		        }
		        else if(flag2 == 2)
		        {
		            ans = t/10;
		            ans = ans%10;
		            flag2 = 3;
		        }
		        else
		        {
		            ans = t%10;
		            flag2 = 0;
		            t++;
		        }
		    }
		}
		System.out.println(ans);
	}
}
