import java.util.*;

class Main{
	public static void main(String args[]){
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		long k = sc.nextLong();
		int work = -1;
		for(int i = 0; i < s.length() && i < k; i++){
			work = Integer.parseInt(s.substring(i,i+1));
			if(work != 1) break;
		}
		System.out.print(work);
	}
} import java.util.*; util.* java class Main{
	public static void main(String args[]){
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		long k = sc.nextLong();
		int work = -1;
		for(int i = 0; i < s.length() && i < k; i++){
			work = Integer.parseInt(s.substring(i,i+1));
			if(work != 1) break;
		}
		System.out.print(work);
	}
} Main public static void main(String args[]){
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		long k = sc.nextLong();
		int work = -1;
		for(int i = 0; i < s.length() && i < k; i++){
			work = Integer.parseInt(s.substring(i,i+1));
			if(work != 1) break;
		}
		System.out.print(work);
	} main {
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		long k = sc.nextLong();
		int work = -1;
		for(int i = 0; i < s.length() && i < k; i++){
			work = Integer.parseInt(s.substring(i,i+1));
			if(work != 1) break;
		}
		System.out.print(work);
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String s = sc.next(); s sc.next() sc.next sc long k = sc.nextLong(); k sc.nextLong() sc.nextLong sc int work = -1; work -1 1 for(int i = 0; i < s.length() && i < k; i++){
			work = Integer.parseInt(s.substring(i,i+1));
			if(work != 1) break;
		} int i = 0; int i = 0; i 0 i < s.length() && i < k i < s.length() i s.length() s.length s i < k i k i++ i++ i {
			work = Integer.parseInt(s.substring(i,i+1));
			if(work != 1) break;
		} {
			work = Integer.parseInt(s.substring(i,i+1));
			if(work != 1) break;
		} work = Integer.parseInt(s.substring(i,i+1)) work Integer.parseInt(s.substring(i,i+1)) Integer.parseInt Integer s.substring(i,i+1) s.substring s i i+1 i 1 if(work != 1) break; work != 1 work 1 break; System.out.print(work) System.out.print System.out System System.out work String args[] args
import java.util.*;

class Main{
	public static void main(String args[]){
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		long k = sc.nextLong();
		int work = -1;
		for(int i = 0; i < s.length() && i < k; i++){
			work = Integer.parseInt(s.substring(i,i+1));
			if(work != 1) break;
		}
		System.out.print(work);
	}
}
