import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		char[] initialString = scanner.nextLine().toCharArray();

		int numLeft1 = 0;
		char leftMostNot1Char = '1';
		for(int i = 0; i < initialString.length; i++) {
			if (initialString[i] == '1') numLeft1++;
			else {
				leftMostNot1Char = initialString[i];
				break;
			}
		}

		if(Long.parseLong(scanner.nextLine()) <= numLeft1) System.out.println('1');
		else System.out.println(leftMostNot1Char);
	}
} import java.util.Scanner; Scanner java.util public class Main {
	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		char[] initialString = scanner.nextLine().toCharArray();

		int numLeft1 = 0;
		char leftMostNot1Char = '1';
		for(int i = 0; i < initialString.length; i++) {
			if (initialString[i] == '1') numLeft1++;
			else {
				leftMostNot1Char = initialString[i];
				break;
			}
		}

		if(Long.parseLong(scanner.nextLine()) <= numLeft1) System.out.println('1');
		else System.out.println(leftMostNot1Char);
	}
} Main public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		char[] initialString = scanner.nextLine().toCharArray();

		int numLeft1 = 0;
		char leftMostNot1Char = '1';
		for(int i = 0; i < initialString.length; i++) {
			if (initialString[i] == '1') numLeft1++;
			else {
				leftMostNot1Char = initialString[i];
				break;
			}
		}

		if(Long.parseLong(scanner.nextLine()) <= numLeft1) System.out.println('1');
		else System.out.println(leftMostNot1Char);
	} main {
		Scanner scanner = new Scanner(System.in);
		char[] initialString = scanner.nextLine().toCharArray();

		int numLeft1 = 0;
		char leftMostNot1Char = '1';
		for(int i = 0; i < initialString.length; i++) {
			if (initialString[i] == '1') numLeft1++;
			else {
				leftMostNot1Char = initialString[i];
				break;
			}
		}

		if(Long.parseLong(scanner.nextLine()) <= numLeft1) System.out.println('1');
		else System.out.println(leftMostNot1Char);
	} Scanner scanner = new Scanner(System.in); scanner new Scanner(System.in) char[] initialString = scanner.nextLine().toCharArray(); initialString scanner.nextLine().toCharArray() scanner.nextLine().toCharArray scanner.nextLine() scanner.nextLine scanner int numLeft1 = 0; numLeft1 0 char leftMostNot1Char = '1'; leftMostNot1Char '1' for(int i = 0; i < initialString.length; i++) {
			if (initialString[i] == '1') numLeft1++;
			else {
				leftMostNot1Char = initialString[i];
				break;
			}
		} int i = 0; int i = 0; i 0 i < initialString.length i initialString.length initialString initialString.length i++ i++ i {
			if (initialString[i] == '1') numLeft1++;
			else {
				leftMostNot1Char = initialString[i];
				break;
			}
		} {
			if (initialString[i] == '1') numLeft1++;
			else {
				leftMostNot1Char = initialString[i];
				break;
			}
		} if (initialString[i] == '1') numLeft1++;
			else {
				leftMostNot1Char = initialString[i];
				break;
			} initialString[i] == '1' initialString[i] initialString i '1' numLeft1++ numLeft1 {
				leftMostNot1Char = initialString[i];
				break;
			} leftMostNot1Char = initialString[i] leftMostNot1Char initialString[i] initialString i break; if(Long.parseLong(scanner.nextLine()) <= numLeft1) System.out.println('1');
		else System.out.println(leftMostNot1Char); Long.parseLong(scanner.nextLine()) <= numLeft1 Long.parseLong(scanner.nextLine()) Long.parseLong Long scanner.nextLine() scanner.nextLine scanner numLeft1 System.out.println('1') System.out.println System.out System System.out '1' System.out.println(leftMostNot1Char) System.out.println System.out System System.out leftMostNot1Char String[] args args public class Main {
	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		char[] initialString = scanner.nextLine().toCharArray();

		int numLeft1 = 0;
		char leftMostNot1Char = '1';
		for(int i = 0; i < initialString.length; i++) {
			if (initialString[i] == '1') numLeft1++;
			else {
				leftMostNot1Char = initialString[i];
				break;
			}
		}

		if(Long.parseLong(scanner.nextLine()) <= numLeft1) System.out.println('1');
		else System.out.println(leftMostNot1Char);
	}
} public class Main {
	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		char[] initialString = scanner.nextLine().toCharArray();

		int numLeft1 = 0;
		char leftMostNot1Char = '1';
		for(int i = 0; i < initialString.length; i++) {
			if (initialString[i] == '1') numLeft1++;
			else {
				leftMostNot1Char = initialString[i];
				break;
			}
		}

		if(Long.parseLong(scanner.nextLine()) <= numLeft1) System.out.println('1');
		else System.out.println(leftMostNot1Char);
	}
} Main
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		char[] initialString = scanner.nextLine().toCharArray();

		int numLeft1 = 0;
		char leftMostNot1Char = '1';
		for(int i = 0; i < initialString.length; i++) {
			if (initialString[i] == '1') numLeft1++;
			else {
				leftMostNot1Char = initialString[i];
				break;
			}
		}

		if(Long.parseLong(scanner.nextLine()) <= numLeft1) System.out.println('1');
		else System.out.println(leftMostNot1Char);
	}
}
