import java.util.*;

public class Main {

    public static void main(String args[]) {

        // 入力
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        long k = Long.parseLong(sc.next());
        sc.close();

        // 主処理
        String result = "0";

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

        if (k <= index) {
            result = "1";
        } else {
            result = String.valueOf(s.charAt(index));
        }

        // 出力
        System.out.println(result);
    }
} import java.util.*; util.* java public class Main {

    public static void main(String args[]) {

        // 入力
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        long k = Long.parseLong(sc.next());
        sc.close();

        // 主処理
        String result = "0";

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

        if (k <= index) {
            result = "1";
        } else {
            result = String.valueOf(s.charAt(index));
        }

        // 出力
        System.out.println(result);
    }
} Main public static void main(String args[]) {

        // 入力
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        long k = Long.parseLong(sc.next());
        sc.close();

        // 主処理
        String result = "0";

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

        if (k <= index) {
            result = "1";
        } else {
            result = String.valueOf(s.charAt(index));
        }

        // 出力
        System.out.println(result);
    } main {

        // 入力
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        long k = Long.parseLong(sc.next());
        sc.close();

        // 主処理
        String result = "0";

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

        if (k <= index) {
            result = "1";
        } else {
            result = String.valueOf(s.charAt(index));
        }

        // 出力
        System.out.println(result);
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String s = sc.next(); s sc.next() sc.next sc long k = Long.parseLong(sc.next()); k Long.parseLong(sc.next()) Long.parseLong Long sc.next() sc.next sc sc.close() sc.close sc String result = "0"; result "0" int index = 0; index 0 for (int i = 0; i < s.length(); i++) {
            if (s.charAt(i) == '1') {
                index++;
            } else {
                break;
            }
        } int i = 0; int i = 0; i 0 i < s.length() i s.length() s.length s i++ i++ i {
            if (s.charAt(i) == '1') {
                index++;
            } else {
                break;
            }
        } {
            if (s.charAt(i) == '1') {
                index++;
            } else {
                break;
            }
        } if (s.charAt(i) == '1') {
                index++;
            } else {
                break;
            } s.charAt(i) == '1' s.charAt(i) s.charAt s i '1' {
                index++;
            } index++ index {
                break;
            } break; if (k <= index) {
            result = "1";
        } else {
            result = String.valueOf(s.charAt(index));
        } k <= index k index {
            result = "1";
        } result = "1" result "1" {
            result = String.valueOf(s.charAt(index));
        } result = String.valueOf(s.charAt(index)) result String.valueOf(s.charAt(index)) String.valueOf String s.charAt(index) s.charAt s index System.out.println(result) System.out.println System.out System System.out result String args[] args public class Main {

    public static void main(String args[]) {

        // 入力
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        long k = Long.parseLong(sc.next());
        sc.close();

        // 主処理
        String result = "0";

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

        if (k <= index) {
            result = "1";
        } else {
            result = String.valueOf(s.charAt(index));
        }

        // 出力
        System.out.println(result);
    }
} public class Main {

    public static void main(String args[]) {

        // 入力
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        long k = Long.parseLong(sc.next());
        sc.close();

        // 主処理
        String result = "0";

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

        if (k <= index) {
            result = "1";
        } else {
            result = String.valueOf(s.charAt(index));
        }

        // 出力
        System.out.println(result);
    }
} Main
import java.util.*;

public class Main {

    public static void main(String args[]) {

        // 入力
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        long k = Long.parseLong(sc.next());
        sc.close();

        // 主処理
        String result = "0";

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

        if (k <= index) {
            result = "1";
        } else {
            result = String.valueOf(s.charAt(index));
        }

        // 出力
        System.out.println(result);
    }
}
