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.util.ArrayList;
import java.util.Arrays;
import java.util.LinkedList;
import java.util.Queue;
import java.util.StringTokenizer;

public class Berland{
	
	public static void main(String[] args) throws NumberFormatException, IOException
	{
		new Berland().run();
	}
	
	public void run() throws NumberFormatException, IOException
	{
		BufferedReader file = new BufferedReader(new InputStreamReader(System.in));
		long N = Long.parseLong(file.readLine());
		long[] cutoff = new long[13];
		cutoff[0] = 0;
		for(int i = 1;i<=12;i++)
		{
			cutoff[i] = cutoff[i-1] + (long)(9*Math.pow(10,i-1))*i;
		}
		int dig = -1;
		for(int i = 0;i<12;i++)
		{
			if(cutoff[i]>=N)
			{
				dig = i;
				break;
			}
		}
		long sub = N - cutoff[dig-1]-1;
		long num = (sub)/dig;
		long number = (long)Math.pow(10,dig-1)+num;
		int pos = (int)(sub % dig);
		System.out.println((number+"").charAt(pos));
	}	
}
