import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		String s = scan.next();
		String k = scan.next();
		scan.close();

		for(int i=0;i<s.length();i++) {
			if(Character.getNumericValue(s.charAt(i))==1) {
				if(k.length()<=3) {
					int K = Integer.valueOf(k);
					if(K-1 == i) {
						System.out.println("1");
						break;
					}
				}
			}else {
				System.out.println(Character.getNumericValue(s.charAt(i)));
				break;
			}
		}
	}

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

	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		String s = scan.next();
		String k = scan.next();
		scan.close();

		for(int i=0;i<s.length();i++) {
			if(Character.getNumericValue(s.charAt(i))==1) {
				if(k.length()<=3) {
					int K = Integer.valueOf(k);
					if(K-1 == i) {
						System.out.println("1");
						break;
					}
				}
			}else {
				System.out.println(Character.getNumericValue(s.charAt(i)));
				break;
			}
		}
	}

} Main public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		String s = scan.next();
		String k = scan.next();
		scan.close();

		for(int i=0;i<s.length();i++) {
			if(Character.getNumericValue(s.charAt(i))==1) {
				if(k.length()<=3) {
					int K = Integer.valueOf(k);
					if(K-1 == i) {
						System.out.println("1");
						break;
					}
				}
			}else {
				System.out.println(Character.getNumericValue(s.charAt(i)));
				break;
			}
		}
	} main {
		Scanner scan = new Scanner(System.in);
		String s = scan.next();
		String k = scan.next();
		scan.close();

		for(int i=0;i<s.length();i++) {
			if(Character.getNumericValue(s.charAt(i))==1) {
				if(k.length()<=3) {
					int K = Integer.valueOf(k);
					if(K-1 == i) {
						System.out.println("1");
						break;
					}
				}
			}else {
				System.out.println(Character.getNumericValue(s.charAt(i)));
				break;
			}
		}
	} Scanner scan = new Scanner(System.in); scan new Scanner(System.in) String s = scan.next(); s scan.next() scan.next scan String k = scan.next(); k scan.next() scan.next scan scan.close() scan.close scan for(int i=0;i<s.length();i++) {
			if(Character.getNumericValue(s.charAt(i))==1) {
				if(k.length()<=3) {
					int K = Integer.valueOf(k);
					if(K-1 == i) {
						System.out.println("1");
						break;
					}
				}
			}else {
				System.out.println(Character.getNumericValue(s.charAt(i)));
				break;
			}
		} int i=0; int i=0; i 0 i<s.length() i s.length() s.length s i++ i++ i {
			if(Character.getNumericValue(s.charAt(i))==1) {
				if(k.length()<=3) {
					int K = Integer.valueOf(k);
					if(K-1 == i) {
						System.out.println("1");
						break;
					}
				}
			}else {
				System.out.println(Character.getNumericValue(s.charAt(i)));
				break;
			}
		} {
			if(Character.getNumericValue(s.charAt(i))==1) {
				if(k.length()<=3) {
					int K = Integer.valueOf(k);
					if(K-1 == i) {
						System.out.println("1");
						break;
					}
				}
			}else {
				System.out.println(Character.getNumericValue(s.charAt(i)));
				break;
			}
		} if(Character.getNumericValue(s.charAt(i))==1) {
				if(k.length()<=3) {
					int K = Integer.valueOf(k);
					if(K-1 == i) {
						System.out.println("1");
						break;
					}
				}
			}else {
				System.out.println(Character.getNumericValue(s.charAt(i)));
				break;
			} Character.getNumericValue(s.charAt(i))==1 Character.getNumericValue(s.charAt(i)) Character.getNumericValue Character s.charAt(i) s.charAt s i 1 {
				if(k.length()<=3) {
					int K = Integer.valueOf(k);
					if(K-1 == i) {
						System.out.println("1");
						break;
					}
				}
			} if(k.length()<=3) {
					int K = Integer.valueOf(k);
					if(K-1 == i) {
						System.out.println("1");
						break;
					}
				} k.length()<=3 k.length() k.length k 3 {
					int K = Integer.valueOf(k);
					if(K-1 == i) {
						System.out.println("1");
						break;
					}
				} int K = Integer.valueOf(k); K Integer.valueOf(k) Integer.valueOf Integer k if(K-1 == i) {
						System.out.println("1");
						break;
					} K-1 == i K-1 K 1 i {
						System.out.println("1");
						break;
					} System.out.println("1") System.out.println System.out System System.out "1" break; {
				System.out.println(Character.getNumericValue(s.charAt(i)));
				break;
			} System.out.println(Character.getNumericValue(s.charAt(i))) System.out.println System.out System System.out Character.getNumericValue(s.charAt(i)) Character.getNumericValue Character s.charAt(i) s.charAt s i break; String[] args args public class Main {

	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		String s = scan.next();
		String k = scan.next();
		scan.close();

		for(int i=0;i<s.length();i++) {
			if(Character.getNumericValue(s.charAt(i))==1) {
				if(k.length()<=3) {
					int K = Integer.valueOf(k);
					if(K-1 == i) {
						System.out.println("1");
						break;
					}
				}
			}else {
				System.out.println(Character.getNumericValue(s.charAt(i)));
				break;
			}
		}
	}

} public class Main {

	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		String s = scan.next();
		String k = scan.next();
		scan.close();

		for(int i=0;i<s.length();i++) {
			if(Character.getNumericValue(s.charAt(i))==1) {
				if(k.length()<=3) {
					int K = Integer.valueOf(k);
					if(K-1 == i) {
						System.out.println("1");
						break;
					}
				}
			}else {
				System.out.println(Character.getNumericValue(s.charAt(i)));
				break;
			}
		}
	}

} Main
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		String s = scan.next();
		String k = scan.next();
		scan.close();

		for(int i=0;i<s.length();i++) {
			if(Character.getNumericValue(s.charAt(i))==1) {
				if(k.length()<=3) {
					int K = Integer.valueOf(k);
					if(K-1 == i) {
						System.out.println("1");
						break;
					}
				}
			}else {
				System.out.println(Character.getNumericValue(s.charAt(i)));
				break;
			}
		}
	}

}