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.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.security.KeyStore.Entry;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
import java.util.LinkedList;
import java.util.PriorityQueue;
import java.util.Queue;
import java.util.Stack;
import java.util.StringTokenizer;
import java.util.TreeMap;

public class codeforcesreturn {
	static class strpair {
		String str1;
		String str2;

		public strpair(String str1, String str2) {
			this.str1 = str1;
			this.str2 = str2;
		}

	}

	static class pair implements Comparable<pair> {
		int numvow;
		char lastvow;
		String str;

		public pair(int numvow, char lastvow, String str) {
			this.numvow = numvow;
			this.lastvow = lastvow;
			this.str = str;
		}

		public int compareTo(pair p) {
			if (numvow == p.numvow)
				return lastvow - p.lastvow;
			return numvow - p.numvow;
		}
	}

	static ArrayList<Integer>[] adjlist;
	static int[][] adjmatrix;
	static int[][] adjmatrix2;
	static boolean[] vis;
	static boolean[] intialvis;
	static boolean[] vis2;
	static int[] counter;
	static int V, E;
	static Stack<Integer> st;
	static ArrayList<Integer> arrylist;
	static boolean flag;
	static int[] dx = new int[] { 1, -1, 0, 0 };
	static int[] dy = new int[] { 0, 0, 1, -1 };
	static int[] Arr;
	static PrintWriter pw;

	public static long gcd(long u, long v) {
		if (u == 0)
			return v;
		return gcd(v % u, u);
	}
	static void print(int n){
				int c=0;
				int m=n;
		while(n!=0){
			c++;	
			n=n/10;
		}
		
		 
		int[]Arr=new int[c];
		for(int i=c-1;i>=0;i--)
		{
			Arr[i]= (m%10);
			m=m/10;
		}
		System.out.println(Arrays.toString(Arr));
	}

	public static String add(String str1, String str2) {
		Stack<String> st = new Stack<String>();
		int n = str1.length();
		
		int m = str2.length();
		int max = Math.max(n, m);
		int sum = 0, carry = 0;
		for (int i = 1; i < max + 1; i++) {
			int num1 = 0, num2 = 0;
			if (n >= i)
				num1 = Integer.parseInt(str1.charAt(n - i) + "");
			if (m >= i)
				num2 = Integer.parseInt(str2.charAt(m - i) + "");
			int z = num1 + num2 + carry;

			carry = z / 10;
			sum = z % 10;
			st.add(sum + "");
		}
		if(carry !=0)st.add(""+carry);
		StringBuilder sb = new StringBuilder();
		while (!st.isEmpty()) {
			sb.append(st.pop());
		}
		return sb + "";
		
	}

	public static void sieve() {

		for (long i = 2; i * i < 2750132; i++)
			if (!vis[(int) i])
				for (long j = i; j * i < 2750132; j++) {
					vis[(int) (i * j)] = true;
					if (counter[(int) (i * j)] == 0)
						counter[(int) (i * j)] = (int) j;
				}
		for (int i = 2; i < 2750132; i++)
			if (!vis[i])
				arrylist.add(i);

	}

	public static boolean bigger(String str) {
		int n = str.length();
		for (int i = 0, j = n / 2; j < n; i++, j++) {
			int x = Integer.parseInt(str.charAt(i) + "");
			int y = Integer.parseInt(str.charAt(j) + "");
			if (x == y)
				continue;
			return x < y;
		}
		return false;
	}

	public static String bigger(String str1, String str2) {
		int n = str1.length();
		int m = str2.length();
		if (n == m) {
			for (int i = 0; i < n; i++) {
				char c1 = str1.charAt(i);
				char c2 = str2.charAt(i);
				if (c1 == c2)
					continue;
				if (c1 < c2)
					return str1;
				return str2;
			}
			return str1;
		} else {
			if (n < m)
				return str1;
			return str2;
		}

	}

	public static void main(String[] args) throws IOException, InterruptedException {
		// FileWriter fileWriter = new
		// FileWriter("C:\\Users\\Hp\\Desktop\\out.txt");
		// PrintWriter pw = new PrintWriter(fileWriter);
		pw = new PrintWriter(System.out);
		Scanner sc = new Scanner(System.in);
		int k = sc.nextInt();
		StringBuilder sb=new StringBuilder();
		for(int i=1;i<10000;i++){
			sb.append(i);
		}
		String str=sb+"";
		System.out.println(str.charAt(k-1));
		
	}

	static class Scanner {
		StringTokenizer st;
		BufferedReader br;

		public Scanner(InputStream s) {
			br = new BufferedReader(new InputStreamReader(s));
		}

		public String next() throws IOException {
			while (st == null || !st.hasMoreTokens())
				st = new StringTokenizer(br.readLine());
			return st.nextToken();
		}

		public int nextInt() throws IOException {
			return Integer.parseInt(next());
		}

		public long nextLong() throws IOException {
			return Long.parseLong(next());
		}

		public String nextLine() throws IOException {
			return br.readLine();
		}

		public double nextDouble() throws IOException {
			String x = next();
			StringBuilder sb = new StringBuilder("0");
			double res = 0, f = 1;
			boolean dec = false, neg = false;
			int start = 0;
			if (x.charAt(0) == '-') {
				neg = true;
				start++;
			}
			for (int i = start; i < x.length(); i++)
				if (x.charAt(i) == '.') {
					res = Long.parseLong(sb.toString());
					sb = new StringBuilder("0");
					dec = true;
				} else {
					sb.append(x.charAt(i));
					if (dec)
						f *= 10;
				}
			res += Long.parseLong(sb.toString()) / f;
			return res * (neg ? -1 : 1);
		}

		public boolean ready() throws IOException {
			return br.ready();
		}

	}

}