
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String str = sc.nextLine();
		long n = sc.nextLong();
		long count1 = 0;
		
		
		if(str.matches("1*")) {
			System.out.println("1");
			return;
		}
		
		for(int i = 0; i<str.length();i++) {
			if(str.charAt(i) == '1') {
				count1 ++;
			}else {
				break;
			}
		}
		if(count1 >= n) {
			System.out.println("1");
			return;
		}
		
		for (int t = 0; t < n; t++) {

			if (str.charAt(t) != '1') {
				System.out.println(str.charAt(t));
				return;
			}
		}
	}

} import java.util.Scanner; Scanner java.util public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String str = sc.nextLine();
		long n = sc.nextLong();
		long count1 = 0;
		
		
		if(str.matches("1*")) {
			System.out.println("1");
			return;
		}
		
		for(int i = 0; i<str.length();i++) {
			if(str.charAt(i) == '1') {
				count1 ++;
			}else {
				break;
			}
		}
		if(count1 >= n) {
			System.out.println("1");
			return;
		}
		
		for (int t = 0; t < n; t++) {

			if (str.charAt(t) != '1') {
				System.out.println(str.charAt(t));
				return;
			}
		}
	}

} Main public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String str = sc.nextLine();
		long n = sc.nextLong();
		long count1 = 0;
		
		
		if(str.matches("1*")) {
			System.out.println("1");
			return;
		}
		
		for(int i = 0; i<str.length();i++) {
			if(str.charAt(i) == '1') {
				count1 ++;
			}else {
				break;
			}
		}
		if(count1 >= n) {
			System.out.println("1");
			return;
		}
		
		for (int t = 0; t < n; t++) {

			if (str.charAt(t) != '1') {
				System.out.println(str.charAt(t));
				return;
			}
		}
	} main {
		Scanner sc = new Scanner(System.in);
		String str = sc.nextLine();
		long n = sc.nextLong();
		long count1 = 0;
		
		
		if(str.matches("1*")) {
			System.out.println("1");
			return;
		}
		
		for(int i = 0; i<str.length();i++) {
			if(str.charAt(i) == '1') {
				count1 ++;
			}else {
				break;
			}
		}
		if(count1 >= n) {
			System.out.println("1");
			return;
		}
		
		for (int t = 0; t < n; t++) {

			if (str.charAt(t) != '1') {
				System.out.println(str.charAt(t));
				return;
			}
		}
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String str = sc.nextLine(); str sc.nextLine() sc.nextLine sc long n = sc.nextLong(); n sc.nextLong() sc.nextLong sc long count1 = 0; count1 0 if(str.matches("1*")) {
			System.out.println("1");
			return;
		} str.matches("1*") str.matches str "1*" {
			System.out.println("1");
			return;
		} System.out.println("1") System.out.println System.out System System.out "1" return; for(int i = 0; i<str.length();i++) {
			if(str.charAt(i) == '1') {
				count1 ++;
			}else {
				break;
			}
		} int i = 0; int i = 0; i 0 i<str.length() i str.length() str.length str i++ i++ i {
			if(str.charAt(i) == '1') {
				count1 ++;
			}else {
				break;
			}
		} {
			if(str.charAt(i) == '1') {
				count1 ++;
			}else {
				break;
			}
		} if(str.charAt(i) == '1') {
				count1 ++;
			}else {
				break;
			} str.charAt(i) == '1' str.charAt(i) str.charAt str i '1' {
				count1 ++;
			} count1 ++ count1 {
				break;
			} break; if(count1 >= n) {
			System.out.println("1");
			return;
		} count1 >= n count1 n {
			System.out.println("1");
			return;
		} System.out.println("1") System.out.println System.out System System.out "1" return; for (int t = 0; t < n; t++) {

			if (str.charAt(t) != '1') {
				System.out.println(str.charAt(t));
				return;
			}
		} int t = 0; int t = 0; t 0 t < n t n t++ t++ t {

			if (str.charAt(t) != '1') {
				System.out.println(str.charAt(t));
				return;
			}
		} {

			if (str.charAt(t) != '1') {
				System.out.println(str.charAt(t));
				return;
			}
		} if (str.charAt(t) != '1') {
				System.out.println(str.charAt(t));
				return;
			} str.charAt(t) != '1' str.charAt(t) str.charAt str t '1' {
				System.out.println(str.charAt(t));
				return;
			} System.out.println(str.charAt(t)) System.out.println System.out System System.out str.charAt(t) str.charAt str t return; String[] args args public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String str = sc.nextLine();
		long n = sc.nextLong();
		long count1 = 0;
		
		
		if(str.matches("1*")) {
			System.out.println("1");
			return;
		}
		
		for(int i = 0; i<str.length();i++) {
			if(str.charAt(i) == '1') {
				count1 ++;
			}else {
				break;
			}
		}
		if(count1 >= n) {
			System.out.println("1");
			return;
		}
		
		for (int t = 0; t < n; t++) {

			if (str.charAt(t) != '1') {
				System.out.println(str.charAt(t));
				return;
			}
		}
	}

} public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String str = sc.nextLine();
		long n = sc.nextLong();
		long count1 = 0;
		
		
		if(str.matches("1*")) {
			System.out.println("1");
			return;
		}
		
		for(int i = 0; i<str.length();i++) {
			if(str.charAt(i) == '1') {
				count1 ++;
			}else {
				break;
			}
		}
		if(count1 >= n) {
			System.out.println("1");
			return;
		}
		
		for (int t = 0; t < n; t++) {

			if (str.charAt(t) != '1') {
				System.out.println(str.charAt(t));
				return;
			}
		}
	}

} Main

import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String str = sc.nextLine();
		long n = sc.nextLong();
		long count1 = 0;
		
		
		if(str.matches("1*")) {
			System.out.println("1");
			return;
		}
		
		for(int i = 0; i<str.length();i++) {
			if(str.charAt(i) == '1') {
				count1 ++;
			}else {
				break;
			}
		}
		if(count1 >= n) {
			System.out.println("1");
			return;
		}
		
		for (int t = 0; t < n; t++) {

			if (str.charAt(t) != '1') {
				System.out.println(str.charAt(t));
				return;
			}
		}
	}

}
