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.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;

public class DigitSeq {

	static class FastReader { 
		BufferedReader br; 
		StringTokenizer st; 

		public FastReader() 
		{ 
			br = new BufferedReader(new
					InputStreamReader(System.in)); 
		} 

		String next() 
		{ 
			while (st == null || !st.hasMoreElements()) 
			{ 
				try
				{ 
					st = new StringTokenizer(br.readLine()); 
				} 
				catch (IOException  e) 
				{ 
					e.printStackTrace(); 
				} 
			} 
			return st.nextToken(); 
		} 

		int nextInt() 
		{ 
			return Integer.parseInt(next()); 
		} 

		long nextLong() 
		{ 
			return Long.parseLong(next()); 
		} 

		double nextDouble() 
		{ 
			return Double.parseDouble(next()); 
		} 

		String nextLine() 
		{ 
			String str = ""; 
			try
			{ 
				str = br.readLine(); 
			} 
			catch (IOException e) 
			{ 
				e.printStackTrace(); 
			} 
			return str; 
		} 
	}

	public static void main(String[] args) {

		FastReader sc = new FastReader();
		OutputStream outputstream = System.out;
		PrintWriter out = new PrintWriter(outputstream);

		long n = sc.nextLong();
		long[] arr = new long[14];
		for(int i = 1; i <= 13; i++){
			arr[i] = (long)Math.pow(10, i)-(long)Math.pow(10, i-1);
		}
		long total = 0;
		/*for(int i = 1; i <= 13; i++) out.print(arr[i] + " ");
		out.println();*/
		for(int i = 1; i <= 13; i++){
			if(total+(long)i*arr[i]>=n){
				long ans = n-total;
				long rest = ans;
				//System.out.println(rest);
				if(ans%i!=0){
					ans /= i;
					ans++;
				} else {
					ans /= i;
				}
				ans += (long)Math.pow(10, i-1)-1;
				String str = Long.toString(ans);
				int ind = (rest%i==0) ? i-1 : (int)(rest%i)-1;
				//System.out.println(ind);
				out.println(str.charAt(ind));
				break;
			}
			total = total+(long)i*arr[i];
			//System.out.println(total);
		}
		out.close();
	}

}