import java.util.Scanner;

class Main {
    static char calc(String str, int index) {
        char answer = str.charAt(0);

        if (str.charAt(0) == '1') {
            int lastIndex = 0;
            for (int i = 1; i < str.length(); i++) {
                if (str.charAt(i) == '1') {
                    lastIndex = i;
                } else {
                    break;
                }
            }

            if (index - 1 <= lastIndex) {
                answer = '1';
            } else {
                answer = str.charAt(lastIndex + 1);
            }
        }

        return answer;
    }

    public static void main(String args[]) {
        String S;
        int K;

        Scanner sc = new Scanner(System.in);
        S = sc.next();
        String k_s = sc.next();
        K = k_s.length() > 3 ? 101 : Integer.valueOf(k_s);

        System.out.println(calc(S, K));
    }
} import java.util.Scanner; Scanner java.util class Main {
    static char calc(String str, int index) {
        char answer = str.charAt(0);

        if (str.charAt(0) == '1') {
            int lastIndex = 0;
            for (int i = 1; i < str.length(); i++) {
                if (str.charAt(i) == '1') {
                    lastIndex = i;
                } else {
                    break;
                }
            }

            if (index - 1 <= lastIndex) {
                answer = '1';
            } else {
                answer = str.charAt(lastIndex + 1);
            }
        }

        return answer;
    }

    public static void main(String args[]) {
        String S;
        int K;

        Scanner sc = new Scanner(System.in);
        S = sc.next();
        String k_s = sc.next();
        K = k_s.length() > 3 ? 101 : Integer.valueOf(k_s);

        System.out.println(calc(S, K));
    }
} Main static char calc(String str, int index) {
        char answer = str.charAt(0);

        if (str.charAt(0) == '1') {
            int lastIndex = 0;
            for (int i = 1; i < str.length(); i++) {
                if (str.charAt(i) == '1') {
                    lastIndex = i;
                } else {
                    break;
                }
            }

            if (index - 1 <= lastIndex) {
                answer = '1';
            } else {
                answer = str.charAt(lastIndex + 1);
            }
        }

        return answer;
    } calc {
        char answer = str.charAt(0);

        if (str.charAt(0) == '1') {
            int lastIndex = 0;
            for (int i = 1; i < str.length(); i++) {
                if (str.charAt(i) == '1') {
                    lastIndex = i;
                } else {
                    break;
                }
            }

            if (index - 1 <= lastIndex) {
                answer = '1';
            } else {
                answer = str.charAt(lastIndex + 1);
            }
        }

        return answer;
    } char answer = str.charAt(0); answer str.charAt(0) str.charAt str 0 if (str.charAt(0) == '1') {
            int lastIndex = 0;
            for (int i = 1; i < str.length(); i++) {
                if (str.charAt(i) == '1') {
                    lastIndex = i;
                } else {
                    break;
                }
            }

            if (index - 1 <= lastIndex) {
                answer = '1';
            } else {
                answer = str.charAt(lastIndex + 1);
            }
        } str.charAt(0) == '1' str.charAt(0) str.charAt str 0 '1' {
            int lastIndex = 0;
            for (int i = 1; i < str.length(); i++) {
                if (str.charAt(i) == '1') {
                    lastIndex = i;
                } else {
                    break;
                }
            }

            if (index - 1 <= lastIndex) {
                answer = '1';
            } else {
                answer = str.charAt(lastIndex + 1);
            }
        } int lastIndex = 0; lastIndex 0 for (int i = 1; i < str.length(); i++) {
                if (str.charAt(i) == '1') {
                    lastIndex = i;
                } else {
                    break;
                }
            } int i = 1; int i = 1; i 1 i < str.length() i str.length() str.length str i++ i++ i {
                if (str.charAt(i) == '1') {
                    lastIndex = i;
                } else {
                    break;
                }
            } {
                if (str.charAt(i) == '1') {
                    lastIndex = i;
                } else {
                    break;
                }
            } if (str.charAt(i) == '1') {
                    lastIndex = i;
                } else {
                    break;
                } str.charAt(i) == '1' str.charAt(i) str.charAt str i '1' {
                    lastIndex = i;
                } lastIndex = i lastIndex i {
                    break;
                } break; if (index - 1 <= lastIndex) {
                answer = '1';
            } else {
                answer = str.charAt(lastIndex + 1);
            } index - 1 <= lastIndex index - 1 index 1 lastIndex {
                answer = '1';
            } answer = '1' answer '1' {
                answer = str.charAt(lastIndex + 1);
            } answer = str.charAt(lastIndex + 1) answer str.charAt(lastIndex + 1) str.charAt str lastIndex + 1 lastIndex 1 return answer; answer String str str int index index public static void main(String args[]) {
        String S;
        int K;

        Scanner sc = new Scanner(System.in);
        S = sc.next();
        String k_s = sc.next();
        K = k_s.length() > 3 ? 101 : Integer.valueOf(k_s);

        System.out.println(calc(S, K));
    } main {
        String S;
        int K;

        Scanner sc = new Scanner(System.in);
        S = sc.next();
        String k_s = sc.next();
        K = k_s.length() > 3 ? 101 : Integer.valueOf(k_s);

        System.out.println(calc(S, K));
    } String S; S int K; K Scanner sc = new Scanner(System.in); sc new Scanner(System.in) S = sc.next() S sc.next() sc.next sc String k_s = sc.next(); k_s sc.next() sc.next sc K = k_s.length() > 3 ? 101 : Integer.valueOf(k_s) K k_s.length() > 3 ? 101 : Integer.valueOf(k_s) k_s.length() > 3 k_s.length() k_s.length k_s 3 101 Integer.valueOf(k_s) Integer.valueOf Integer k_s System.out.println(calc(S, K)) System.out.println System.out System System.out calc(S, K) calc S K String args[] args
import java.util.Scanner;

class Main {
    static char calc(String str, int index) {
        char answer = str.charAt(0);

        if (str.charAt(0) == '1') {
            int lastIndex = 0;
            for (int i = 1; i < str.length(); i++) {
                if (str.charAt(i) == '1') {
                    lastIndex = i;
                } else {
                    break;
                }
            }

            if (index - 1 <= lastIndex) {
                answer = '1';
            } else {
                answer = str.charAt(lastIndex + 1);
            }
        }

        return answer;
    }

    public static void main(String args[]) {
        String S;
        int K;

        Scanner sc = new Scanner(System.in);
        S = sc.next();
        String k_s = sc.next();
        K = k_s.length() > 3 ? 101 : Integer.valueOf(k_s);

        System.out.println(calc(S, K));
    }
}
