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;

public class CodeForces1177B {
	
	public static char custBinSearch(long lower, long upper, long lowIndex, int ten, long position) {
		long half = Math.round((lower + upper) / 2.0);
		
		long lowBound = lowIndex + (half - lower)*(ten + 1);
		long upBound = lowBound + ten;
		
		if(position < lowBound) { //Less than the lowest index of half
			return custBinSearch(lower, half - 1, lowIndex, ten, position);
			
		} else if (position > upBound) { //Remember to update lowIndex here.
			lowIndex += (half + 1 - lower)*(ten + 1);
			return custBinSearch(half + 1, upper, lowIndex, ten, position);
			
		} else {
			return Long.toString(half).charAt((int) (position - lowBound)); //The final number will at max be 11 characters long, thus it is safe to convert and cast.
			
		}
		
	}
	
	public static void main(String[] args) throws IOException  {
		BufferedReader inputs = new BufferedReader(new InputStreamReader(System.in));
		
		long indexPosition = Long.parseLong(inputs.readLine());
		
		inputs.close();
		
		//Isolate possible combinations so that all further numbers will have the same length.
		int tenFactor = 0;
		long lowerBound = 1;
		long upperBound = (long) (Math.pow(10, 12));
		long lowerIndexBound = 1;
		long redIndex = 0;
		redIndex += indexPosition;
		
		while(redIndex > 0) {
			redIndex -= (long) (9*Math.pow(10, tenFactor)*(tenFactor + 1));
			if(redIndex <= 0) { //Stage 1: Completed Successfully.
				lowerBound = (long) (Math.pow(10, tenFactor));
				upperBound = (long) (Math.pow(10, tenFactor + 1) - 1);
				break;
			}
			
			lowerIndexBound += (long) (9*Math.pow(10, tenFactor)*(tenFactor + 1));
			tenFactor++;
			
		}
		
		System.out.println(custBinSearch(lowerBound, upperBound, lowerIndexBound, tenFactor, indexPosition));
		
	}
}
