import java.util.ArrayList;
import java.util.Arrays;
import java.util.PriorityQueue;
import java.util.Scanner;

public class Main {
	Scanner sc = new Scanner(System.in);
	public static void main(String[] args){
		new Main();
	}
	public Main(){
//		new ABC105().doIt();
		new ABC106().doIt(); //No_chedck
//		new ABC107().doIt();
//		new ABC108().doIt(); //Math
//		new ABC109().doIt(); //LCM
	}
	class ABC105{
		void doIt() {
			long n = sc.nextLong();
			String str = "";
			for(long i = 1; n != 0; i *= -2) {
				if((n % (i*2)) != 0) {
					n -= i;
					str = "1" + str;
				}
				else{
					str = "0" + str;
				}
//				System.out.println(str);
			}
			if(str.isEmpty()) str = "0";
			System.out.println(str);
		}
	}
	class ABC106{
		void doIt() {
			String str = sc.next();
			long K = sc.nextLong();
			int ans = 0;
			for(int i = 0;i < str.length();i++) {
				long pos = i + 1;
				int num = Integer.parseInt(""+str.charAt(i));
				if(pos == K || num > 1) {
					ans = num;
					break;
				}
			}
			System.out.println(ans);
		}
	}
	class ABC107{
		void doIt() {
			int N = sc.nextInt();
			int K = sc.nextInt() - 1;
			long x[] = new long[N];
			long ans = Integer.MAX_VALUE;
			for(int i = 0;i < N ;i++)x[i] = sc.nextLong();
			for(int i = 0;i < N - K;i++) {
				long dist = Math.abs(x[i] - x[i + K]);
				if(x[i + K] < 0)dist = dist + Math.abs(0 - x[i + K]);
				else if(x[i] > 0)dist = dist + Math.abs(0 - x[i]);
				else dist = dist + Math.min(Math.abs(x[i]),x[i+K]);
				ans = Math.min(ans, dist);
			}
			System.out.println(ans);
		}
	}
	class ABC108{
		void doIt() {
			int N = sc.nextInt();
			int K = sc.nextInt();
			long A = 0;
			long A_2 = 0;
			for(int i = 1;i <= N;i++) {
				if(i % K == 0)A++;
				else if(i*2 % K == 0)A_2++;
			}
			long ans = A*A*A + A_2*A_2*A_2;
			System.out.println(ans);
		}
	}
	class ABC109{
		int euqulid(int A,int B) {
			if(B > 0)return euqulid(B,A % B);
			else return A;
		}
		void doIt(){
			int n = sc.nextInt();
			int X = sc.nextInt();
			int ans = Integer.MAX_VALUE;
			for(int i = 0;i < n;i++) {
				int x = sc.nextInt();
				int dist = Math.abs(x - X);
				if(i == 0)ans = dist;
				else ans = euqulid(dist,ans);
			}
			System.out.println(ans);
		}
	}
} import java.util.ArrayList; ArrayList java.util import java.util.Arrays; Arrays java.util import java.util.PriorityQueue; PriorityQueue java.util import java.util.Scanner; Scanner java.util public class Main {
	Scanner sc = new Scanner(System.in);
	public static void main(String[] args){
		new Main();
	}
	public Main(){
//		new ABC105().doIt();
		new ABC106().doIt(); //No_chedck
//		new ABC107().doIt();
//		new ABC108().doIt(); //Math
//		new ABC109().doIt(); //LCM
	}
	class ABC105{
		void doIt() {
			long n = sc.nextLong();
			String str = "";
			for(long i = 1; n != 0; i *= -2) {
				if((n % (i*2)) != 0) {
					n -= i;
					str = "1" + str;
				}
				else{
					str = "0" + str;
				}
//				System.out.println(str);
			}
			if(str.isEmpty()) str = "0";
			System.out.println(str);
		}
	}
	class ABC106{
		void doIt() {
			String str = sc.next();
			long K = sc.nextLong();
			int ans = 0;
			for(int i = 0;i < str.length();i++) {
				long pos = i + 1;
				int num = Integer.parseInt(""+str.charAt(i));
				if(pos == K || num > 1) {
					ans = num;
					break;
				}
			}
			System.out.println(ans);
		}
	}
	class ABC107{
		void doIt() {
			int N = sc.nextInt();
			int K = sc.nextInt() - 1;
			long x[] = new long[N];
			long ans = Integer.MAX_VALUE;
			for(int i = 0;i < N ;i++)x[i] = sc.nextLong();
			for(int i = 0;i < N - K;i++) {
				long dist = Math.abs(x[i] - x[i + K]);
				if(x[i + K] < 0)dist = dist + Math.abs(0 - x[i + K]);
				else if(x[i] > 0)dist = dist + Math.abs(0 - x[i]);
				else dist = dist + Math.min(Math.abs(x[i]),x[i+K]);
				ans = Math.min(ans, dist);
			}
			System.out.println(ans);
		}
	}
	class ABC108{
		void doIt() {
			int N = sc.nextInt();
			int K = sc.nextInt();
			long A = 0;
			long A_2 = 0;
			for(int i = 1;i <= N;i++) {
				if(i % K == 0)A++;
				else if(i*2 % K == 0)A_2++;
			}
			long ans = A*A*A + A_2*A_2*A_2;
			System.out.println(ans);
		}
	}
	class ABC109{
		int euqulid(int A,int B) {
			if(B > 0)return euqulid(B,A % B);
			else return A;
		}
		void doIt(){
			int n = sc.nextInt();
			int X = sc.nextInt();
			int ans = Integer.MAX_VALUE;
			for(int i = 0;i < n;i++) {
				int x = sc.nextInt();
				int dist = Math.abs(x - X);
				if(i == 0)ans = dist;
				else ans = euqulid(dist,ans);
			}
			System.out.println(ans);
		}
	}
} Main Scanner sc = new Scanner(System.in); sc new Scanner(System.in) public static void main(String[] args){
		new Main();
	} main {
		new Main();
	} new Main() String[] args args public Main(){
//		new ABC105().doIt();
		new ABC106().doIt(); //No_chedck
//		new ABC107().doIt();
//		new ABC108().doIt(); //Math
//		new ABC109().doIt(); //LCM
	} Main {
//		new ABC105().doIt();
		new ABC106().doIt(); //No_chedck
//		new ABC107().doIt();
//		new ABC108().doIt(); //Math
//		new ABC109().doIt(); //LCM
	} new ABC106().doIt() new ABC106().doIt new ABC106() class ABC105{
		void doIt() {
			long n = sc.nextLong();
			String str = "";
			for(long i = 1; n != 0; i *= -2) {
				if((n % (i*2)) != 0) {
					n -= i;
					str = "1" + str;
				}
				else{
					str = "0" + str;
				}
//				System.out.println(str);
			}
			if(str.isEmpty()) str = "0";
			System.out.println(str);
		}
	} ABC105 void doIt() {
			long n = sc.nextLong();
			String str = "";
			for(long i = 1; n != 0; i *= -2) {
				if((n % (i*2)) != 0) {
					n -= i;
					str = "1" + str;
				}
				else{
					str = "0" + str;
				}
//				System.out.println(str);
			}
			if(str.isEmpty()) str = "0";
			System.out.println(str);
		} doIt {
			long n = sc.nextLong();
			String str = "";
			for(long i = 1; n != 0; i *= -2) {
				if((n % (i*2)) != 0) {
					n -= i;
					str = "1" + str;
				}
				else{
					str = "0" + str;
				}
//				System.out.println(str);
			}
			if(str.isEmpty()) str = "0";
			System.out.println(str);
		} long n = sc.nextLong(); n sc.nextLong() sc.nextLong sc String str = ""; str "" for(long i = 1; n != 0; i *= -2) {
				if((n % (i*2)) != 0) {
					n -= i;
					str = "1" + str;
				}
				else{
					str = "0" + str;
				}
//				System.out.println(str);
			} long i = 1; long i = 1; i 1 n != 0 n 0 i *= -2 i *= -2 i -2 2 {
				if((n % (i*2)) != 0) {
					n -= i;
					str = "1" + str;
				}
				else{
					str = "0" + str;
				}
//				System.out.println(str);
			} {
				if((n % (i*2)) != 0) {
					n -= i;
					str = "1" + str;
				}
				else{
					str = "0" + str;
				}
//				System.out.println(str);
			} if((n % (i*2)) != 0) {
					n -= i;
					str = "1" + str;
				}
				else{
					str = "0" + str;
				} (n % (i*2)) != 0 (n % (i*2)) n (i*2) i 2 0 {
					n -= i;
					str = "1" + str;
				} n -= i n i str = "1" + str str "1" + str "1" str {
					str = "0" + str;
				} str = "0" + str str "0" + str "0" str if(str.isEmpty()) str = "0"; str.isEmpty() str.isEmpty str str = "0" str "0" System.out.println(str) System.out.println System.out System System.out str class ABC106{
		void doIt() {
			String str = sc.next();
			long K = sc.nextLong();
			int ans = 0;
			for(int i = 0;i < str.length();i++) {
				long pos = i + 1;
				int num = Integer.parseInt(""+str.charAt(i));
				if(pos == K || num > 1) {
					ans = num;
					break;
				}
			}
			System.out.println(ans);
		}
	} ABC106 void doIt() {
			String str = sc.next();
			long K = sc.nextLong();
			int ans = 0;
			for(int i = 0;i < str.length();i++) {
				long pos = i + 1;
				int num = Integer.parseInt(""+str.charAt(i));
				if(pos == K || num > 1) {
					ans = num;
					break;
				}
			}
			System.out.println(ans);
		} doIt {
			String str = sc.next();
			long K = sc.nextLong();
			int ans = 0;
			for(int i = 0;i < str.length();i++) {
				long pos = i + 1;
				int num = Integer.parseInt(""+str.charAt(i));
				if(pos == K || num > 1) {
					ans = num;
					break;
				}
			}
			System.out.println(ans);
		} String str = sc.next(); str sc.next() sc.next sc long K = sc.nextLong(); K sc.nextLong() sc.nextLong sc int ans = 0; ans 0 for(int i = 0;i < str.length();i++) {
				long pos = i + 1;
				int num = Integer.parseInt(""+str.charAt(i));
				if(pos == K || num > 1) {
					ans = num;
					break;
				}
			} int i = 0; int i = 0; i 0 i < str.length() i str.length() str.length str i++ i++ i {
				long pos = i + 1;
				int num = Integer.parseInt(""+str.charAt(i));
				if(pos == K || num > 1) {
					ans = num;
					break;
				}
			} {
				long pos = i + 1;
				int num = Integer.parseInt(""+str.charAt(i));
				if(pos == K || num > 1) {
					ans = num;
					break;
				}
			} long pos = i + 1; pos i + 1 i 1 int num = Integer.parseInt(""+str.charAt(i)); num Integer.parseInt(""+str.charAt(i)) Integer.parseInt Integer ""+str.charAt(i) "" str.charAt(i) str.charAt str i if(pos == K || num > 1) {
					ans = num;
					break;
				} pos == K || num > 1 pos == K pos K num > 1 num 1 {
					ans = num;
					break;
				} ans = num ans num break; System.out.println(ans) System.out.println System.out System System.out ans class ABC107{
		void doIt() {
			int N = sc.nextInt();
			int K = sc.nextInt() - 1;
			long x[] = new long[N];
			long ans = Integer.MAX_VALUE;
			for(int i = 0;i < N ;i++)x[i] = sc.nextLong();
			for(int i = 0;i < N - K;i++) {
				long dist = Math.abs(x[i] - x[i + K]);
				if(x[i + K] < 0)dist = dist + Math.abs(0 - x[i + K]);
				else if(x[i] > 0)dist = dist + Math.abs(0 - x[i]);
				else dist = dist + Math.min(Math.abs(x[i]),x[i+K]);
				ans = Math.min(ans, dist);
			}
			System.out.println(ans);
		}
	} ABC107 void doIt() {
			int N = sc.nextInt();
			int K = sc.nextInt() - 1;
			long x[] = new long[N];
			long ans = Integer.MAX_VALUE;
			for(int i = 0;i < N ;i++)x[i] = sc.nextLong();
			for(int i = 0;i < N - K;i++) {
				long dist = Math.abs(x[i] - x[i + K]);
				if(x[i + K] < 0)dist = dist + Math.abs(0 - x[i + K]);
				else if(x[i] > 0)dist = dist + Math.abs(0 - x[i]);
				else dist = dist + Math.min(Math.abs(x[i]),x[i+K]);
				ans = Math.min(ans, dist);
			}
			System.out.println(ans);
		} doIt {
			int N = sc.nextInt();
			int K = sc.nextInt() - 1;
			long x[] = new long[N];
			long ans = Integer.MAX_VALUE;
			for(int i = 0;i < N ;i++)x[i] = sc.nextLong();
			for(int i = 0;i < N - K;i++) {
				long dist = Math.abs(x[i] - x[i + K]);
				if(x[i + K] < 0)dist = dist + Math.abs(0 - x[i + K]);
				else if(x[i] > 0)dist = dist + Math.abs(0 - x[i]);
				else dist = dist + Math.min(Math.abs(x[i]),x[i+K]);
				ans = Math.min(ans, dist);
			}
			System.out.println(ans);
		} int N = sc.nextInt(); N sc.nextInt() sc.nextInt sc int K = sc.nextInt() - 1; K sc.nextInt() - 1 sc.nextInt() sc.nextInt sc 1 long x[] = new long[N]; x new long[N] N long ans = Integer.MAX_VALUE; ans Integer.MAX_VALUE Integer Integer.MAX_VALUE for(int i = 0;i < N ;i++)x[i] = sc.nextLong(); int i = 0; int i = 0; i 0 i < N i N i++ i++ i x[i] = sc.nextLong(); x[i] = sc.nextLong() x[i] x i sc.nextLong() sc.nextLong sc for(int i = 0;i < N - K;i++) {
				long dist = Math.abs(x[i] - x[i + K]);
				if(x[i + K] < 0)dist = dist + Math.abs(0 - x[i + K]);
				else if(x[i] > 0)dist = dist + Math.abs(0 - x[i]);
				else dist = dist + Math.min(Math.abs(x[i]),x[i+K]);
				ans = Math.min(ans, dist);
			} int i = 0; int i = 0; i 0 i < N - K i N - K N K i++ i++ i {
				long dist = Math.abs(x[i] - x[i + K]);
				if(x[i + K] < 0)dist = dist + Math.abs(0 - x[i + K]);
				else if(x[i] > 0)dist = dist + Math.abs(0 - x[i]);
				else dist = dist + Math.min(Math.abs(x[i]),x[i+K]);
				ans = Math.min(ans, dist);
			} {
				long dist = Math.abs(x[i] - x[i + K]);
				if(x[i + K] < 0)dist = dist + Math.abs(0 - x[i + K]);
				else if(x[i] > 0)dist = dist + Math.abs(0 - x[i]);
				else dist = dist + Math.min(Math.abs(x[i]),x[i+K]);
				ans = Math.min(ans, dist);
			} long dist = Math.abs(x[i] - x[i + K]); dist Math.abs(x[i] - x[i + K]) Math.abs Math x[i] - x[i + K] x[i] x i x[i + K] x i + K i K if(x[i + K] < 0)dist = dist + Math.abs(0 - x[i + K]);
				else if(x[i] > 0)dist = dist + Math.abs(0 - x[i]);
				else dist = dist + Math.min(Math.abs(x[i]),x[i+K]); x[i + K] < 0 x[i + K] x i + K i K 0 dist = dist + Math.abs(0 - x[i + K]) dist dist + Math.abs(0 - x[i + K]) dist Math.abs(0 - x[i + K]) Math.abs Math 0 - x[i + K] 0 x[i + K] x i + K i K if(x[i] > 0)dist = dist + Math.abs(0 - x[i]);
				else dist = dist + Math.min(Math.abs(x[i]),x[i+K]); x[i] > 0 x[i] x i 0 dist = dist + Math.abs(0 - x[i]) dist dist + Math.abs(0 - x[i]) dist Math.abs(0 - x[i]) Math.abs Math 0 - x[i] 0 x[i] x i dist = dist + Math.min(Math.abs(x[i]),x[i+K]) dist dist + Math.min(Math.abs(x[i]),x[i+K]) dist Math.min(Math.abs(x[i]),x[i+K]) Math.min Math Math.abs(x[i]) Math.abs Math x[i] x i x[i+K] x i+K i K ans = Math.min(ans, dist) ans Math.min(ans, dist) Math.min Math ans dist System.out.println(ans) System.out.println System.out System System.out ans class ABC108{
		void doIt() {
			int N = sc.nextInt();
			int K = sc.nextInt();
			long A = 0;
			long A_2 = 0;
			for(int i = 1;i <= N;i++) {
				if(i % K == 0)A++;
				else if(i*2 % K == 0)A_2++;
			}
			long ans = A*A*A + A_2*A_2*A_2;
			System.out.println(ans);
		}
	} ABC108 void doIt() {
			int N = sc.nextInt();
			int K = sc.nextInt();
			long A = 0;
			long A_2 = 0;
			for(int i = 1;i <= N;i++) {
				if(i % K == 0)A++;
				else if(i*2 % K == 0)A_2++;
			}
			long ans = A*A*A + A_2*A_2*A_2;
			System.out.println(ans);
		} doIt {
			int N = sc.nextInt();
			int K = sc.nextInt();
			long A = 0;
			long A_2 = 0;
			for(int i = 1;i <= N;i++) {
				if(i % K == 0)A++;
				else if(i*2 % K == 0)A_2++;
			}
			long ans = A*A*A + A_2*A_2*A_2;
			System.out.println(ans);
		} int N = sc.nextInt(); N sc.nextInt() sc.nextInt sc int K = sc.nextInt(); K sc.nextInt() sc.nextInt sc long A = 0; A 0 long A_2 = 0; A_2 0 for(int i = 1;i <= N;i++) {
				if(i % K == 0)A++;
				else if(i*2 % K == 0)A_2++;
			} int i = 1; int i = 1; i 1 i <= N i N i++ i++ i {
				if(i % K == 0)A++;
				else if(i*2 % K == 0)A_2++;
			} {
				if(i % K == 0)A++;
				else if(i*2 % K == 0)A_2++;
			} if(i % K == 0)A++;
				else if(i*2 % K == 0)A_2++; i % K == 0 i % K i K 0 A++ A if(i*2 % K == 0)A_2++; i*2 % K == 0 i*2 % K i*2 i 2 K 0 A_2++ A_2 long ans = A*A*A + A_2*A_2*A_2; ans A*A*A + A_2*A_2*A_2 A*A*A A*A*A A A A A_2*A_2*A_2 A_2*A_2*A_2 A_2 A_2 A_2 System.out.println(ans) System.out.println System.out System System.out ans class ABC109{
		int euqulid(int A,int B) {
			if(B > 0)return euqulid(B,A % B);
			else return A;
		}
		void doIt(){
			int n = sc.nextInt();
			int X = sc.nextInt();
			int ans = Integer.MAX_VALUE;
			for(int i = 0;i < n;i++) {
				int x = sc.nextInt();
				int dist = Math.abs(x - X);
				if(i == 0)ans = dist;
				else ans = euqulid(dist,ans);
			}
			System.out.println(ans);
		}
	} ABC109 int euqulid(int A,int B) {
			if(B > 0)return euqulid(B,A % B);
			else return A;
		} euqulid {
			if(B > 0)return euqulid(B,A % B);
			else return A;
		} if(B > 0)return euqulid(B,A % B);
			else return A; B > 0 B 0 return euqulid(B,A % B); euqulid(B,A % B) euqulid B A % B A B return A; A int A A int B B void doIt(){
			int n = sc.nextInt();
			int X = sc.nextInt();
			int ans = Integer.MAX_VALUE;
			for(int i = 0;i < n;i++) {
				int x = sc.nextInt();
				int dist = Math.abs(x - X);
				if(i == 0)ans = dist;
				else ans = euqulid(dist,ans);
			}
			System.out.println(ans);
		} doIt {
			int n = sc.nextInt();
			int X = sc.nextInt();
			int ans = Integer.MAX_VALUE;
			for(int i = 0;i < n;i++) {
				int x = sc.nextInt();
				int dist = Math.abs(x - X);
				if(i == 0)ans = dist;
				else ans = euqulid(dist,ans);
			}
			System.out.println(ans);
		} int n = sc.nextInt(); n sc.nextInt() sc.nextInt sc int X = sc.nextInt(); X sc.nextInt() sc.nextInt sc int ans = Integer.MAX_VALUE; ans Integer.MAX_VALUE Integer Integer.MAX_VALUE for(int i = 0;i < n;i++) {
				int x = sc.nextInt();
				int dist = Math.abs(x - X);
				if(i == 0)ans = dist;
				else ans = euqulid(dist,ans);
			} int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
				int x = sc.nextInt();
				int dist = Math.abs(x - X);
				if(i == 0)ans = dist;
				else ans = euqulid(dist,ans);
			} {
				int x = sc.nextInt();
				int dist = Math.abs(x - X);
				if(i == 0)ans = dist;
				else ans = euqulid(dist,ans);
			} int x = sc.nextInt(); x sc.nextInt() sc.nextInt sc int dist = Math.abs(x - X); dist Math.abs(x - X) Math.abs Math x - X x X if(i == 0)ans = dist;
				else ans = euqulid(dist,ans); i == 0 i 0 ans = dist ans dist ans = euqulid(dist,ans) ans euqulid(dist,ans) euqulid dist ans System.out.println(ans) System.out.println System.out System System.out ans public class Main {
	Scanner sc = new Scanner(System.in);
	public static void main(String[] args){
		new Main();
	}
	public Main(){
//		new ABC105().doIt();
		new ABC106().doIt(); //No_chedck
//		new ABC107().doIt();
//		new ABC108().doIt(); //Math
//		new ABC109().doIt(); //LCM
	}
	class ABC105{
		void doIt() {
			long n = sc.nextLong();
			String str = "";
			for(long i = 1; n != 0; i *= -2) {
				if((n % (i*2)) != 0) {
					n -= i;
					str = "1" + str;
				}
				else{
					str = "0" + str;
				}
//				System.out.println(str);
			}
			if(str.isEmpty()) str = "0";
			System.out.println(str);
		}
	}
	class ABC106{
		void doIt() {
			String str = sc.next();
			long K = sc.nextLong();
			int ans = 0;
			for(int i = 0;i < str.length();i++) {
				long pos = i + 1;
				int num = Integer.parseInt(""+str.charAt(i));
				if(pos == K || num > 1) {
					ans = num;
					break;
				}
			}
			System.out.println(ans);
		}
	}
	class ABC107{
		void doIt() {
			int N = sc.nextInt();
			int K = sc.nextInt() - 1;
			long x[] = new long[N];
			long ans = Integer.MAX_VALUE;
			for(int i = 0;i < N ;i++)x[i] = sc.nextLong();
			for(int i = 0;i < N - K;i++) {
				long dist = Math.abs(x[i] - x[i + K]);
				if(x[i + K] < 0)dist = dist + Math.abs(0 - x[i + K]);
				else if(x[i] > 0)dist = dist + Math.abs(0 - x[i]);
				else dist = dist + Math.min(Math.abs(x[i]),x[i+K]);
				ans = Math.min(ans, dist);
			}
			System.out.println(ans);
		}
	}
	class ABC108{
		void doIt() {
			int N = sc.nextInt();
			int K = sc.nextInt();
			long A = 0;
			long A_2 = 0;
			for(int i = 1;i <= N;i++) {
				if(i % K == 0)A++;
				else if(i*2 % K == 0)A_2++;
			}
			long ans = A*A*A + A_2*A_2*A_2;
			System.out.println(ans);
		}
	}
	class ABC109{
		int euqulid(int A,int B) {
			if(B > 0)return euqulid(B,A % B);
			else return A;
		}
		void doIt(){
			int n = sc.nextInt();
			int X = sc.nextInt();
			int ans = Integer.MAX_VALUE;
			for(int i = 0;i < n;i++) {
				int x = sc.nextInt();
				int dist = Math.abs(x - X);
				if(i == 0)ans = dist;
				else ans = euqulid(dist,ans);
			}
			System.out.println(ans);
		}
	}
} public class Main {
	Scanner sc = new Scanner(System.in);
	public static void main(String[] args){
		new Main();
	}
	public Main(){
//		new ABC105().doIt();
		new ABC106().doIt(); //No_chedck
//		new ABC107().doIt();
//		new ABC108().doIt(); //Math
//		new ABC109().doIt(); //LCM
	}
	class ABC105{
		void doIt() {
			long n = sc.nextLong();
			String str = "";
			for(long i = 1; n != 0; i *= -2) {
				if((n % (i*2)) != 0) {
					n -= i;
					str = "1" + str;
				}
				else{
					str = "0" + str;
				}
//				System.out.println(str);
			}
			if(str.isEmpty()) str = "0";
			System.out.println(str);
		}
	}
	class ABC106{
		void doIt() {
			String str = sc.next();
			long K = sc.nextLong();
			int ans = 0;
			for(int i = 0;i < str.length();i++) {
				long pos = i + 1;
				int num = Integer.parseInt(""+str.charAt(i));
				if(pos == K || num > 1) {
					ans = num;
					break;
				}
			}
			System.out.println(ans);
		}
	}
	class ABC107{
		void doIt() {
			int N = sc.nextInt();
			int K = sc.nextInt() - 1;
			long x[] = new long[N];
			long ans = Integer.MAX_VALUE;
			for(int i = 0;i < N ;i++)x[i] = sc.nextLong();
			for(int i = 0;i < N - K;i++) {
				long dist = Math.abs(x[i] - x[i + K]);
				if(x[i + K] < 0)dist = dist + Math.abs(0 - x[i + K]);
				else if(x[i] > 0)dist = dist + Math.abs(0 - x[i]);
				else dist = dist + Math.min(Math.abs(x[i]),x[i+K]);
				ans = Math.min(ans, dist);
			}
			System.out.println(ans);
		}
	}
	class ABC108{
		void doIt() {
			int N = sc.nextInt();
			int K = sc.nextInt();
			long A = 0;
			long A_2 = 0;
			for(int i = 1;i <= N;i++) {
				if(i % K == 0)A++;
				else if(i*2 % K == 0)A_2++;
			}
			long ans = A*A*A + A_2*A_2*A_2;
			System.out.println(ans);
		}
	}
	class ABC109{
		int euqulid(int A,int B) {
			if(B > 0)return euqulid(B,A % B);
			else return A;
		}
		void doIt(){
			int n = sc.nextInt();
			int X = sc.nextInt();
			int ans = Integer.MAX_VALUE;
			for(int i = 0;i < n;i++) {
				int x = sc.nextInt();
				int dist = Math.abs(x - X);
				if(i == 0)ans = dist;
				else ans = euqulid(dist,ans);
			}
			System.out.println(ans);
		}
	}
} Main
import java.util.ArrayList;
import java.util.Arrays;
import java.util.PriorityQueue;
import java.util.Scanner;

public class Main {
	Scanner sc = new Scanner(System.in);
	public static void main(String[] args){
		new Main();
	}
	public Main(){
//		new ABC105().doIt();
		new ABC106().doIt(); //No_chedck
//		new ABC107().doIt();
//		new ABC108().doIt(); //Math
//		new ABC109().doIt(); //LCM
	}
	class ABC105{
		void doIt() {
			long n = sc.nextLong();
			String str = "";
			for(long i = 1; n != 0; i *= -2) {
				if((n % (i*2)) != 0) {
					n -= i;
					str = "1" + str;
				}
				else{
					str = "0" + str;
				}
//				System.out.println(str);
			}
			if(str.isEmpty()) str = "0";
			System.out.println(str);
		}
	}
	class ABC106{
		void doIt() {
			String str = sc.next();
			long K = sc.nextLong();
			int ans = 0;
			for(int i = 0;i < str.length();i++) {
				long pos = i + 1;
				int num = Integer.parseInt(""+str.charAt(i));
				if(pos == K || num > 1) {
					ans = num;
					break;
				}
			}
			System.out.println(ans);
		}
	}
	class ABC107{
		void doIt() {
			int N = sc.nextInt();
			int K = sc.nextInt() - 1;
			long x[] = new long[N];
			long ans = Integer.MAX_VALUE;
			for(int i = 0;i < N ;i++)x[i] = sc.nextLong();
			for(int i = 0;i < N - K;i++) {
				long dist = Math.abs(x[i] - x[i + K]);
				if(x[i + K] < 0)dist = dist + Math.abs(0 - x[i + K]);
				else if(x[i] > 0)dist = dist + Math.abs(0 - x[i]);
				else dist = dist + Math.min(Math.abs(x[i]),x[i+K]);
				ans = Math.min(ans, dist);
			}
			System.out.println(ans);
		}
	}
	class ABC108{
		void doIt() {
			int N = sc.nextInt();
			int K = sc.nextInt();
			long A = 0;
			long A_2 = 0;
			for(int i = 1;i <= N;i++) {
				if(i % K == 0)A++;
				else if(i*2 % K == 0)A_2++;
			}
			long ans = A*A*A + A_2*A_2*A_2;
			System.out.println(ans);
		}
	}
	class ABC109{
		int euqulid(int A,int B) {
			if(B > 0)return euqulid(B,A % B);
			else return A;
		}
		void doIt(){
			int n = sc.nextInt();
			int X = sc.nextInt();
			int ans = Integer.MAX_VALUE;
			for(int i = 0;i < n;i++) {
				int x = sc.nextInt();
				int dist = Math.abs(x - X);
				if(i == 0)ans = dist;
				else ans = euqulid(dist,ans);
			}
			System.out.println(ans);
		}
	}
}
