import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		char[] s = in.nextLine().toCharArray();
		long k = Long.parseLong(in.nextLine());
		System.out.println(solve(s, k));
		in.close();
	}

	private static char solve(char[] s, long k) {
		int index = getIndex(s);
		if (index < 0) {
			// すべて1で構成されている
			return '1';
		} else if (index > k - 1) {
			// １の範囲
			return '1';
		} else {
			return s[index];
		}
	}

	private static int getIndex(char[] s) {
		int result = -1;
		for (int i = 0; i < s.length; ++i) {
			if (s[i] != '1') {
				result = i;
				break;
			}
		}
		return result;
	}
} import java.util.Scanner; Scanner java.util public class Main {

	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		char[] s = in.nextLine().toCharArray();
		long k = Long.parseLong(in.nextLine());
		System.out.println(solve(s, k));
		in.close();
	}

	private static char solve(char[] s, long k) {
		int index = getIndex(s);
		if (index < 0) {
			// すべて1で構成されている
			return '1';
		} else if (index > k - 1) {
			// １の範囲
			return '1';
		} else {
			return s[index];
		}
	}

	private static int getIndex(char[] s) {
		int result = -1;
		for (int i = 0; i < s.length; ++i) {
			if (s[i] != '1') {
				result = i;
				break;
			}
		}
		return result;
	}
} Main public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		char[] s = in.nextLine().toCharArray();
		long k = Long.parseLong(in.nextLine());
		System.out.println(solve(s, k));
		in.close();
	} main {
		Scanner in = new Scanner(System.in);
		char[] s = in.nextLine().toCharArray();
		long k = Long.parseLong(in.nextLine());
		System.out.println(solve(s, k));
		in.close();
	} Scanner in = new Scanner(System.in); in new Scanner(System.in) char[] s = in.nextLine().toCharArray(); s in.nextLine().toCharArray() in.nextLine().toCharArray in.nextLine() in.nextLine in long k = Long.parseLong(in.nextLine()); k Long.parseLong(in.nextLine()) Long.parseLong Long in.nextLine() in.nextLine in System.out.println(solve(s, k)) System.out.println System.out System System.out solve(s, k) solve s k in.close() in.close in String[] args args private static char solve(char[] s, long k) {
		int index = getIndex(s);
		if (index < 0) {
			// すべて1で構成されている
			return '1';
		} else if (index > k - 1) {
			// １の範囲
			return '1';
		} else {
			return s[index];
		}
	} solve {
		int index = getIndex(s);
		if (index < 0) {
			// すべて1で構成されている
			return '1';
		} else if (index > k - 1) {
			// １の範囲
			return '1';
		} else {
			return s[index];
		}
	} int index = getIndex(s); index getIndex(s) getIndex s if (index < 0) {
			// すべて1で構成されている
			return '1';
		} else if (index > k - 1) {
			// １の範囲
			return '1';
		} else {
			return s[index];
		} index < 0 index 0 {
			// すべて1で構成されている
			return '1';
		} return '1'; '1' if (index > k - 1) {
			// １の範囲
			return '1';
		} else {
			return s[index];
		} index > k - 1 index k - 1 k 1 {
			// １の範囲
			return '1';
		} return '1'; '1' {
			return s[index];
		} return s[index]; s[index] s index char[] s s long k k private static int getIndex(char[] s) {
		int result = -1;
		for (int i = 0; i < s.length; ++i) {
			if (s[i] != '1') {
				result = i;
				break;
			}
		}
		return result;
	} getIndex {
		int result = -1;
		for (int i = 0; i < s.length; ++i) {
			if (s[i] != '1') {
				result = i;
				break;
			}
		}
		return result;
	} int result = -1; result -1 1 for (int i = 0; i < s.length; ++i) {
			if (s[i] != '1') {
				result = i;
				break;
			}
		} int i = 0; int i = 0; i 0 i < s.length i s.length s s.length ++i ++i i {
			if (s[i] != '1') {
				result = i;
				break;
			}
		} {
			if (s[i] != '1') {
				result = i;
				break;
			}
		} if (s[i] != '1') {
				result = i;
				break;
			} s[i] != '1' s[i] s i '1' {
				result = i;
				break;
			} result = i result i break; return result; result char[] s s public class Main {

	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		char[] s = in.nextLine().toCharArray();
		long k = Long.parseLong(in.nextLine());
		System.out.println(solve(s, k));
		in.close();
	}

	private static char solve(char[] s, long k) {
		int index = getIndex(s);
		if (index < 0) {
			// すべて1で構成されている
			return '1';
		} else if (index > k - 1) {
			// １の範囲
			return '1';
		} else {
			return s[index];
		}
	}

	private static int getIndex(char[] s) {
		int result = -1;
		for (int i = 0; i < s.length; ++i) {
			if (s[i] != '1') {
				result = i;
				break;
			}
		}
		return result;
	}
} public class Main {

	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		char[] s = in.nextLine().toCharArray();
		long k = Long.parseLong(in.nextLine());
		System.out.println(solve(s, k));
		in.close();
	}

	private static char solve(char[] s, long k) {
		int index = getIndex(s);
		if (index < 0) {
			// すべて1で構成されている
			return '1';
		} else if (index > k - 1) {
			// １の範囲
			return '1';
		} else {
			return s[index];
		}
	}

	private static int getIndex(char[] s) {
		int result = -1;
		for (int i = 0; i < s.length; ++i) {
			if (s[i] != '1') {
				result = i;
				break;
			}
		}
		return result;
	}
} Main
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		char[] s = in.nextLine().toCharArray();
		long k = Long.parseLong(in.nextLine());
		System.out.println(solve(s, k));
		in.close();
	}

	private static char solve(char[] s, long k) {
		int index = getIndex(s);
		if (index < 0) {
			// すべて1で構成されている
			return '1';
		} else if (index > k - 1) {
			// １の範囲
			return '1';
		} else {
			return s[index];
		}
	}

	private static int getIndex(char[] s) {
		int result = -1;
		for (int i = 0; i < s.length; ++i) {
			if (s[i] != '1') {
				result = i;
				break;
			}
		}
		return result;
	}
}