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.lang.reflect.Array;
import java.util.ArrayList;
import java.util.Queue;
import java.util.Scanner;

public class Tests {
	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		long inputNum = 0;
		String finalResult = "";

		inputNum = scanner.nextLong();
		long upperLimitResult = 0;
		long lowerLimitResult = 0;
		int multiplier = 0;
		do {
			multiplier++;
			lowerLimitResult = upperLimitResult;
			upperLimitResult += 9 * Math.pow(10, multiplier - 1) * (multiplier);
		} while (inputNum > upperLimitResult);
		long remainderFromLowerRange = inputNum - lowerLimitResult;
		long repititions = 0;
		if (multiplier > 1)
			repititions = (remainderFromLowerRange - 1 > 0 ? remainderFromLowerRange - 1 : 0) / multiplier;
		long currentNumber = (long) (Math.pow(10, multiplier - 1) + repititions);
		remainderFromLowerRange = remainderFromLowerRange - repititions * multiplier;
		long digitIndex = remainderFromLowerRange < multiplier ? multiplier - remainderFromLowerRange
				: remainderFromLowerRange % multiplier;

		if (multiplier == 1) {
			finalResult = (remainderFromLowerRange % 10) + "";
		} else {
			int charToGet = (int) ((multiplier - 1) - digitIndex);
			finalResult = (currentNumber + "").charAt(charToGet) + "";
		}
		System.out.print(finalResult);
		scanner.close();
	}

}
