import java.util.Scanner;

class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		String k = sc.next();
		int i = 0;
		char ans = '2';
		while(i < s.length()){
			ans = s.charAt(i);
			if(ans != '1')break;
			i++;
		}
		
		if(k.length()>3||Integer.parseInt(k)>i)System.out.println(ans);
		else System.out.println(1);
	}
} import java.util.Scanner; Scanner java.util class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		String k = sc.next();
		int i = 0;
		char ans = '2';
		while(i < s.length()){
			ans = s.charAt(i);
			if(ans != '1')break;
			i++;
		}
		
		if(k.length()>3||Integer.parseInt(k)>i)System.out.println(ans);
		else System.out.println(1);
	}
} Main public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		String k = sc.next();
		int i = 0;
		char ans = '2';
		while(i < s.length()){
			ans = s.charAt(i);
			if(ans != '1')break;
			i++;
		}
		
		if(k.length()>3||Integer.parseInt(k)>i)System.out.println(ans);
		else System.out.println(1);
	} main {
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		String k = sc.next();
		int i = 0;
		char ans = '2';
		while(i < s.length()){
			ans = s.charAt(i);
			if(ans != '1')break;
			i++;
		}
		
		if(k.length()>3||Integer.parseInt(k)>i)System.out.println(ans);
		else System.out.println(1);
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String s = sc.next(); s sc.next() sc.next sc String k = sc.next(); k sc.next() sc.next sc int i = 0; i 0 char ans = '2'; ans '2' while(i < s.length()){
			ans = s.charAt(i);
			if(ans != '1')break;
			i++;
		} i < s.length() i s.length() s.length s {
			ans = s.charAt(i);
			if(ans != '1')break;
			i++;
		} ans = s.charAt(i) ans s.charAt(i) s.charAt s i if(ans != '1')break; ans != '1' ans '1' break; i++ i if(k.length()>3||Integer.parseInt(k)>i)System.out.println(ans);
		else System.out.println(1); k.length()>3||Integer.parseInt(k)>i k.length()>3 k.length() k.length k 3 Integer.parseInt(k)>i Integer.parseInt(k) Integer.parseInt Integer k i System.out.println(ans) System.out.println System.out System System.out ans System.out.println(1) System.out.println System.out System System.out 1 String[] args args
import java.util.Scanner;

class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		String k = sc.next();
		int i = 0;
		char ans = '2';
		while(i < s.length()){
			ans = s.charAt(i);
			if(ans != '1')break;
			i++;
		}
		
		if(k.length()>3||Integer.parseInt(k)>i)System.out.println(ans);
		else System.out.println(1);
	}
}