import java.util.Scanner;
class Main{
	public static void main(String[]args) {
	Scanner scan=new Scanner(System.in);
	String str=scan.next();
	long b=scan.nextLong();
	int count=0;
	for(int i=0;i!=str.length();i++) {
		char ch=str.charAt(i);
		if(ch!='1') {
		break;
		}
		count++;
	}
	if(b<=count) {
		System.out.println(1);
		return;
	}
	for(int i=0;i<str.length();i++) {
		char ch=str.charAt(i);
		if(ch!='1') {
			System.out.println(ch);
			return;
		}
	}
	System.out.println(1);
	}
} import java.util.Scanner; Scanner java.util class Main{
	public static void main(String[]args) {
	Scanner scan=new Scanner(System.in);
	String str=scan.next();
	long b=scan.nextLong();
	int count=0;
	for(int i=0;i!=str.length();i++) {
		char ch=str.charAt(i);
		if(ch!='1') {
		break;
		}
		count++;
	}
	if(b<=count) {
		System.out.println(1);
		return;
	}
	for(int i=0;i<str.length();i++) {
		char ch=str.charAt(i);
		if(ch!='1') {
			System.out.println(ch);
			return;
		}
	}
	System.out.println(1);
	}
} Main public static void main(String[]args) {
	Scanner scan=new Scanner(System.in);
	String str=scan.next();
	long b=scan.nextLong();
	int count=0;
	for(int i=0;i!=str.length();i++) {
		char ch=str.charAt(i);
		if(ch!='1') {
		break;
		}
		count++;
	}
	if(b<=count) {
		System.out.println(1);
		return;
	}
	for(int i=0;i<str.length();i++) {
		char ch=str.charAt(i);
		if(ch!='1') {
			System.out.println(ch);
			return;
		}
	}
	System.out.println(1);
	} main {
	Scanner scan=new Scanner(System.in);
	String str=scan.next();
	long b=scan.nextLong();
	int count=0;
	for(int i=0;i!=str.length();i++) {
		char ch=str.charAt(i);
		if(ch!='1') {
		break;
		}
		count++;
	}
	if(b<=count) {
		System.out.println(1);
		return;
	}
	for(int i=0;i<str.length();i++) {
		char ch=str.charAt(i);
		if(ch!='1') {
			System.out.println(ch);
			return;
		}
	}
	System.out.println(1);
	} Scanner scan=new Scanner(System.in); scan new Scanner(System.in) String str=scan.next(); str scan.next() scan.next scan long b=scan.nextLong(); b scan.nextLong() scan.nextLong scan int count=0; count 0 for(int i=0;i!=str.length();i++) {
		char ch=str.charAt(i);
		if(ch!='1') {
		break;
		}
		count++;
	} int i=0; int i=0; i 0 i!=str.length() i str.length() str.length str i++ i++ i {
		char ch=str.charAt(i);
		if(ch!='1') {
		break;
		}
		count++;
	} {
		char ch=str.charAt(i);
		if(ch!='1') {
		break;
		}
		count++;
	} char ch=str.charAt(i); ch str.charAt(i) str.charAt str i if(ch!='1') {
		break;
		} ch!='1' ch '1' {
		break;
		} break; count++ count if(b<=count) {
		System.out.println(1);
		return;
	} b<=count b count {
		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++) {
		char ch=str.charAt(i);
		if(ch!='1') {
			System.out.println(ch);
			return;
		}
	} int i=0; int i=0; i 0 i<str.length() i str.length() str.length str i++ i++ i {
		char ch=str.charAt(i);
		if(ch!='1') {
			System.out.println(ch);
			return;
		}
	} {
		char ch=str.charAt(i);
		if(ch!='1') {
			System.out.println(ch);
			return;
		}
	} char ch=str.charAt(i); ch str.charAt(i) str.charAt str i if(ch!='1') {
			System.out.println(ch);
			return;
		} ch!='1' ch '1' {
			System.out.println(ch);
			return;
		} System.out.println(ch) System.out.println System.out System System.out ch return; 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 scan=new Scanner(System.in);
	String str=scan.next();
	long b=scan.nextLong();
	int count=0;
	for(int i=0;i!=str.length();i++) {
		char ch=str.charAt(i);
		if(ch!='1') {
		break;
		}
		count++;
	}
	if(b<=count) {
		System.out.println(1);
		return;
	}
	for(int i=0;i<str.length();i++) {
		char ch=str.charAt(i);
		if(ch!='1') {
			System.out.println(ch);
			return;
		}
	}
	System.out.println(1);
	}
}