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
// package name;
import java.io.*;
import java.util.*;

public class Main {

	public static void main(String[] args) throws IOException {
		Scanner s = new Scanner(System.in);
		long k = s.nextLong();
		
		long dp[] = new long[13];
		long x = 9; int i = 1;
		
		long ansx = 0; int ansi = 0;
		for(; i < 13; i++) {
			dp[i] = dp[i - 1] + x * i;
			x *= 10;
			if(k <= dp[i]) {
				ansx = x;
				ansi = i;
				break;
			}
			
			if(dp[i] > 1000000000000l) break;
		}
		
		if(ansi < 2) {
			System.out.println(k);
			return;
		}
		
		k -= dp[ansi - 1];
		
		//System.out.println(k);
		
		long st = (long)Math.pow(10, ansi - 1);
		
		long div = (k / ansi);
		if(k % ansi == 0) div--;
		
		k -= div * ansi;
		
		//System.out.println(k);
		System.out.println(findKthDigit(st + div, k));
		
	}

	private static Long findKthDigit(long xx, long k) {
		int z = (int) k;
		ArrayList<Long> arr = new ArrayList();
		while(xx > 0) {
			arr.add(xx % 10);
			xx /= 10;
		}
		return arr.get(arr.size() - z);
	}

}