import java.util.*;
//import static java.lang.Integer.*;
import static java.lang.Long.*;
import static java.lang.Math.*;
import static java.lang.System.*;

public class Main {
	public static void main(String[] args) {
		int i,j;
		Scanner sc = new Scanner(in);
		char[] s = sc.next().toCharArray();
		long k = parseLong(sc.next());
		sc.close();
		int ans = 0;
		for(i=0;i<k;i++) {
			ans = s[i]-'0';
			if(ans!=1) break;
		}
		out.println(ans);
	}
} import java.util.*; util.* java import static java.lang.Long.*; import static java.lang.Long.*; import static java.lang.Long.*; import static java.lang.Math.*; import static java.lang.Math.*; import static java.lang.Math.*; import static java.lang.System.*; import static java.lang.System.*; import static java.lang.System.*; public class Main {
	public static void main(String[] args) {
		int i,j;
		Scanner sc = new Scanner(in);
		char[] s = sc.next().toCharArray();
		long k = parseLong(sc.next());
		sc.close();
		int ans = 0;
		for(i=0;i<k;i++) {
			ans = s[i]-'0';
			if(ans!=1) break;
		}
		out.println(ans);
	}
} Main public static void main(String[] args) {
		int i,j;
		Scanner sc = new Scanner(in);
		char[] s = sc.next().toCharArray();
		long k = parseLong(sc.next());
		sc.close();
		int ans = 0;
		for(i=0;i<k;i++) {
			ans = s[i]-'0';
			if(ans!=1) break;
		}
		out.println(ans);
	} main {
		int i,j;
		Scanner sc = new Scanner(in);
		char[] s = sc.next().toCharArray();
		long k = parseLong(sc.next());
		sc.close();
		int ans = 0;
		for(i=0;i<k;i++) {
			ans = s[i]-'0';
			if(ans!=1) break;
		}
		out.println(ans);
	} int i i j; j Scanner sc = new Scanner(in); sc new Scanner(in) char[] s = sc.next().toCharArray(); s sc.next().toCharArray() sc.next().toCharArray sc.next() sc.next sc long k = parseLong(sc.next()); k parseLong(sc.next()) parseLong sc.next() sc.next sc sc.close() sc.close sc int ans = 0; ans 0 for(i=0;i<k;i++) {
			ans = s[i]-'0';
			if(ans!=1) break;
		} i=0; i=0 i 0 i<k i k i++ i++ i {
			ans = s[i]-'0';
			if(ans!=1) break;
		} {
			ans = s[i]-'0';
			if(ans!=1) break;
		} ans = s[i]-'0' ans s[i]-'0' s[i] s i '0' if(ans!=1) break; ans!=1 ans 1 break; out.println(ans) out.println out ans String[] args args public class Main {
	public static void main(String[] args) {
		int i,j;
		Scanner sc = new Scanner(in);
		char[] s = sc.next().toCharArray();
		long k = parseLong(sc.next());
		sc.close();
		int ans = 0;
		for(i=0;i<k;i++) {
			ans = s[i]-'0';
			if(ans!=1) break;
		}
		out.println(ans);
	}
} public class Main {
	public static void main(String[] args) {
		int i,j;
		Scanner sc = new Scanner(in);
		char[] s = sc.next().toCharArray();
		long k = parseLong(sc.next());
		sc.close();
		int ans = 0;
		for(i=0;i<k;i++) {
			ans = s[i]-'0';
			if(ans!=1) break;
		}
		out.println(ans);
	}
} Main
import java.util.*;
//import static java.lang.Integer.*;
import static java.lang.Long.*;
import static java.lang.Math.*;
import static java.lang.System.*;

public class Main {
	public static void main(String[] args) {
		int i,j;
		Scanner sc = new Scanner(in);
		char[] s = sc.next().toCharArray();
		long k = parseLong(sc.next());
		sc.close();
		int ans = 0;
		for(i=0;i<k;i++) {
			ans = s[i]-'0';
			if(ans!=1) break;
		}
		out.println(ans);
	}
}