import java.util.*;

public class Main {
	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		String s = in.nextLine();
		long a = in.nextLong();
		int b = 0;
		for(int i = 0;i < s.length();i ++) {
			if(s.charAt(i) == '1')b ++;
			else break;
		}
		if(b >= a)System.out.println(1);
		else System.out.println(s.charAt(b));
	}
} import java.util.*; util.* java public class Main {
	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		String s = in.nextLine();
		long a = in.nextLong();
		int b = 0;
		for(int i = 0;i < s.length();i ++) {
			if(s.charAt(i) == '1')b ++;
			else break;
		}
		if(b >= a)System.out.println(1);
		else System.out.println(s.charAt(b));
	}
} Main public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		String s = in.nextLine();
		long a = in.nextLong();
		int b = 0;
		for(int i = 0;i < s.length();i ++) {
			if(s.charAt(i) == '1')b ++;
			else break;
		}
		if(b >= a)System.out.println(1);
		else System.out.println(s.charAt(b));
	} main {
		Scanner in = new Scanner(System.in);
		String s = in.nextLine();
		long a = in.nextLong();
		int b = 0;
		for(int i = 0;i < s.length();i ++) {
			if(s.charAt(i) == '1')b ++;
			else break;
		}
		if(b >= a)System.out.println(1);
		else System.out.println(s.charAt(b));
	} Scanner in = new Scanner(System.in); in new Scanner(System.in) String s = in.nextLine(); s in.nextLine() in.nextLine in long a = in.nextLong(); a in.nextLong() in.nextLong in int b = 0; b 0 for(int i = 0;i < s.length();i ++) {
			if(s.charAt(i) == '1')b ++;
			else break;
		} int i = 0; int i = 0; i 0 i < s.length() i s.length() s.length s i ++ i ++ i {
			if(s.charAt(i) == '1')b ++;
			else break;
		} {
			if(s.charAt(i) == '1')b ++;
			else break;
		} if(s.charAt(i) == '1')b ++;
			else break; s.charAt(i) == '1' s.charAt(i) s.charAt s i '1' b ++ b break; if(b >= a)System.out.println(1);
		else System.out.println(s.charAt(b)); b >= a b a System.out.println(1) System.out.println System.out System System.out 1 System.out.println(s.charAt(b)) System.out.println System.out System System.out s.charAt(b) s.charAt s b String[] args args public class Main {
	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		String s = in.nextLine();
		long a = in.nextLong();
		int b = 0;
		for(int i = 0;i < s.length();i ++) {
			if(s.charAt(i) == '1')b ++;
			else break;
		}
		if(b >= a)System.out.println(1);
		else System.out.println(s.charAt(b));
	}
} public class Main {
	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		String s = in.nextLine();
		long a = in.nextLong();
		int b = 0;
		for(int i = 0;i < s.length();i ++) {
			if(s.charAt(i) == '1')b ++;
			else break;
		}
		if(b >= a)System.out.println(1);
		else System.out.println(s.charAt(b));
	}
} Main
import java.util.*;

public class Main {
	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		String s = in.nextLine();
		long a = in.nextLong();
		int b = 0;
		for(int i = 0;i < s.length();i ++) {
			if(s.charAt(i) == '1')b ++;
			else break;
		}
		if(b >= a)System.out.println(1);
		else System.out.println(s.charAt(b));
	}
}
