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

public class test_round_A {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner sc=new Scanner(System.in);
		int k=sc.nextInt();
		int i=0;
		int d=0;
		
		int a=0;
		while(i<=k)
		{
			if(i==k)
			{
				break;
			}
			else
			{
				d++;
				int temp=0;
				for(int j=0;j<d;j++)
				{
					temp=temp*10+9;
				}
				i=i+d*(temp-a);
				a=temp;
			}
			
			
			
		}
		
		//System.out.println(a) ;
		int b=a/10;
		int t=b;
		int dig;
		if(b==0)
		{
			dig=0;
		}
		else
		{
			dig=Integer.toString(b).length();
		}
		
		//System.out.println(dig);
		int flag=dig+1;
		int num=0;
		while(b>0)
		{
			//System.out.println("sun");
			int rev=b/10;
			num+=(b-rev)*dig;
			b=b/10;
			dig--;
			
		}
		//System.out.println(num);
		//System.out.println(t);
		int net=k-num;
		int div=net/flag;
		int q;
		if(net%flag==0)
		{
			//System.out.println("s");
			//System.out.println();
			q=0;
			t=t+div;
			System.out.println((t)%10);
		}
		else
		{
			//System.out.println(div);
			//System.out.println(flag);
			//System.out.println(net);
			int r=div*flag;
			r=net-r;
			q=Integer.toString(net%flag).length();
			
			
			//System.out.println(q);
			//System.out.println(t);
			//System.out.println(div);
			//System.out.println(w);
			t=t+div+1;
			String c=Integer.toString(t);
			//System.out.println(r);
			//System.out.println(c);
			//int f=t/w;
			//System.out.println(f);
			System.out.println(c.substring(r-1,r));
		}
		
		
		
		
		

	}

}
