import java.util.*;

class Main {
    public static void main(String[] args) {
        new Solver().run();
    }
}

class Solver {

    public void run() {
        Scanner sc = new Scanner(System.in);
        char[] S = sc.next().toCharArray();
        long K = sc.nextLong();

        int ans = 1;
        for (int i = 0; i < S.length; i++) {
            char ch = S[i];
            if (ch == '1') {
                if (K - 1 == i)  {
                    ans = 1;
                    break;
                }
            } else {
                ans = ch - '0';
                break;
            }

        }

        System.out.println(ans);
        return;
    }

} import java.util.*; util.* java class Main {
    public static void main(String[] args) {
        new Solver().run();
    }
} Main public static void main(String[] args) {
        new Solver().run();
    } main {
        new Solver().run();
    } new Solver().run() new Solver().run new Solver() String[] args args class Solver {

    public void run() {
        Scanner sc = new Scanner(System.in);
        char[] S = sc.next().toCharArray();
        long K = sc.nextLong();

        int ans = 1;
        for (int i = 0; i < S.length; i++) {
            char ch = S[i];
            if (ch == '1') {
                if (K - 1 == i)  {
                    ans = 1;
                    break;
                }
            } else {
                ans = ch - '0';
                break;
            }

        }

        System.out.println(ans);
        return;
    }

} Solver public void run() {
        Scanner sc = new Scanner(System.in);
        char[] S = sc.next().toCharArray();
        long K = sc.nextLong();

        int ans = 1;
        for (int i = 0; i < S.length; i++) {
            char ch = S[i];
            if (ch == '1') {
                if (K - 1 == i)  {
                    ans = 1;
                    break;
                }
            } else {
                ans = ch - '0';
                break;
            }

        }

        System.out.println(ans);
        return;
    } run {
        Scanner sc = new Scanner(System.in);
        char[] S = sc.next().toCharArray();
        long K = sc.nextLong();

        int ans = 1;
        for (int i = 0; i < S.length; i++) {
            char ch = S[i];
            if (ch == '1') {
                if (K - 1 == i)  {
                    ans = 1;
                    break;
                }
            } else {
                ans = ch - '0';
                break;
            }

        }

        System.out.println(ans);
        return;
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) char[] S = sc.next().toCharArray(); S sc.next().toCharArray() sc.next().toCharArray sc.next() sc.next sc long K = sc.nextLong(); K sc.nextLong() sc.nextLong sc int ans = 1; ans 1 for (int i = 0; i < S.length; i++) {
            char ch = S[i];
            if (ch == '1') {
                if (K - 1 == i)  {
                    ans = 1;
                    break;
                }
            } else {
                ans = ch - '0';
                break;
            }

        } int i = 0; int i = 0; i 0 i < S.length i S.length S S.length i++ i++ i {
            char ch = S[i];
            if (ch == '1') {
                if (K - 1 == i)  {
                    ans = 1;
                    break;
                }
            } else {
                ans = ch - '0';
                break;
            }

        } {
            char ch = S[i];
            if (ch == '1') {
                if (K - 1 == i)  {
                    ans = 1;
                    break;
                }
            } else {
                ans = ch - '0';
                break;
            }

        } char ch = S[i]; ch S[i] S i if (ch == '1') {
                if (K - 1 == i)  {
                    ans = 1;
                    break;
                }
            } else {
                ans = ch - '0';
                break;
            } ch == '1' ch '1' {
                if (K - 1 == i)  {
                    ans = 1;
                    break;
                }
            } if (K - 1 == i)  {
                    ans = 1;
                    break;
                } K - 1 == i K - 1 K 1 i {
                    ans = 1;
                    break;
                } ans = 1 ans 1 break; {
                ans = ch - '0';
                break;
            } ans = ch - '0' ans ch - '0' ch '0' break; System.out.println(ans) System.out.println System.out System System.out ans return;
import java.util.*;

class Main {
    public static void main(String[] args) {
        new Solver().run();
    }
}

class Solver {

    public void run() {
        Scanner sc = new Scanner(System.in);
        char[] S = sc.next().toCharArray();
        long K = sc.nextLong();

        int ans = 1;
        for (int i = 0; i < S.length; i++) {
            char ch = S[i];
            if (ch == '1') {
                if (K - 1 == i)  {
                    ans = 1;
                    break;
                }
            } else {
                ans = ch - '0';
                break;
            }

        }

        System.out.println(ans);
        return;
    }

}