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.*;
import java.util.Scanner;
public class Test {
	public static int digit(long number){
		int i = 1;
		long exp = 1;
		while(number > i * 9 * exp){
			number -= i * 9 * exp;
			i++;
			exp *= 10;
		}
		return i;
	}
	public static int result(long number){
		int digit = digit(number);
		long exp = 1;
		for(int i = 0; i < (digit - 1); i++){
			number -= (i+1) * 9 * exp;
			exp *= 10;
		}
		long b = number / digit;
		int c = (int)(number % digit);
		if(c > 0){
			String d = Long.toString(exp + b);
			return d.charAt(c - 1) - '0';
		}
		else{
			String d = Long.toString(exp + b - 1);
			return d.charAt(d.length() - 1) - '0';
		}

	}
	public static void main(String[] args){
		Scanner input = new Scanner(System.in);
		long k = input.nextLong();
		System.out.println(result(k));
	}
}



