import java.io.*;

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

        if (str.charAt(0) == '1') {
            int lastIndex = 0;
            int str_l = str.length();
            for (int i = 1; i < str_l; 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[]) throws IOException {
        String S;
        int K;

        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        S = br.readLine();
        String k_s = br.readLine();
        K = k_s.length() > 3 ? 101 : Integer.parseInt(k_s);

        PrintWriter pw = new PrintWriter(System.out);
        pw.println(calc(S, K));
        pw.flush();
    }
} import java.io.*; io.* java class Main {
    static char calc(String str, int index) {
        char answer = str.charAt(0);

        if (str.charAt(0) == '1') {
            int lastIndex = 0;
            int str_l = str.length();
            for (int i = 1; i < str_l; 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[]) throws IOException {
        String S;
        int K;

        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        S = br.readLine();
        String k_s = br.readLine();
        K = k_s.length() > 3 ? 101 : Integer.parseInt(k_s);

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

        if (str.charAt(0) == '1') {
            int lastIndex = 0;
            int str_l = str.length();
            for (int i = 1; i < str_l; 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;
            int str_l = str.length();
            for (int i = 1; i < str_l; 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;
            int str_l = str.length();
            for (int i = 1; i < str_l; 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;
            int str_l = str.length();
            for (int i = 1; i < str_l; 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 int str_l = str.length(); str_l str.length() str.length str for (int i = 1; i < str_l; i++) {
                if (str.charAt(i) == '1') {
                    lastIndex = i;
                } else {
                    break;
                }
            } int i = 1; int i = 1; i 1 i < str_l i str_l 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[]) throws IOException {
        String S;
        int K;

        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        S = br.readLine();
        String k_s = br.readLine();
        K = k_s.length() > 3 ? 101 : Integer.parseInt(k_s);

        PrintWriter pw = new PrintWriter(System.out);
        pw.println(calc(S, K));
        pw.flush();
    } main {
        String S;
        int K;

        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        S = br.readLine();
        String k_s = br.readLine();
        K = k_s.length() > 3 ? 101 : Integer.parseInt(k_s);

        PrintWriter pw = new PrintWriter(System.out);
        pw.println(calc(S, K));
        pw.flush();
    } String S; S int K; K BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); br new BufferedReader(new InputStreamReader(System.in)) S = br.readLine() S br.readLine() br.readLine br String k_s = br.readLine(); k_s br.readLine() br.readLine br K = k_s.length() > 3 ? 101 : Integer.parseInt(k_s) K k_s.length() > 3 ? 101 : Integer.parseInt(k_s) k_s.length() > 3 k_s.length() k_s.length k_s 3 101 Integer.parseInt(k_s) Integer.parseInt Integer k_s PrintWriter pw = new PrintWriter(System.out); pw new PrintWriter(System.out) pw.println(calc(S, K)) pw.println pw calc(S, K) calc S K pw.flush() pw.flush pw String args[] args
import java.io.*;

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

        if (str.charAt(0) == '1') {
            int lastIndex = 0;
            int str_l = str.length();
            for (int i = 1; i < str_l; 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[]) throws IOException {
        String S;
        int K;

        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        S = br.readLine();
        String k_s = br.readLine();
        K = k_s.length() > 3 ? 101 : Integer.parseInt(k_s);

        PrintWriter pw = new PrintWriter(System.out);
        pw.println(calc(S, K));
        pw.flush();
    }
}
