
import java.util.*;

public class Main {

    public static void main(String args[]) {
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        long k = sc.nextLong();
        boolean[] one = new boolean[s.length()];
        int num = 0;
        for (int i = 0; i < s.length(); i++) {
            if (i == 0) {
                if (s.charAt(i) == '1')
                    one[i] = true;
            } else {
                one[i] = s.charAt(i) == '1' && one[i - 1];
            }

            if (num == 0 && s.charAt(i) != '1')
                num = s.charAt(i) - '0';
        }
        if (k > one.length) {
            System.out.println(num);
        } else {
            if (one[(int) (k - 1)])
                System.out.println(1);
            else
                System.out.println(num);
        }
    }

} 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 = sc.nextLong();
        boolean[] one = new boolean[s.length()];
        int num = 0;
        for (int i = 0; i < s.length(); i++) {
            if (i == 0) {
                if (s.charAt(i) == '1')
                    one[i] = true;
            } else {
                one[i] = s.charAt(i) == '1' && one[i - 1];
            }

            if (num == 0 && s.charAt(i) != '1')
                num = s.charAt(i) - '0';
        }
        if (k > one.length) {
            System.out.println(num);
        } else {
            if (one[(int) (k - 1)])
                System.out.println(1);
            else
                System.out.println(num);
        }
    }

} Main public static void main(String args[]) {
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        long k = sc.nextLong();
        boolean[] one = new boolean[s.length()];
        int num = 0;
        for (int i = 0; i < s.length(); i++) {
            if (i == 0) {
                if (s.charAt(i) == '1')
                    one[i] = true;
            } else {
                one[i] = s.charAt(i) == '1' && one[i - 1];
            }

            if (num == 0 && s.charAt(i) != '1')
                num = s.charAt(i) - '0';
        }
        if (k > one.length) {
            System.out.println(num);
        } else {
            if (one[(int) (k - 1)])
                System.out.println(1);
            else
                System.out.println(num);
        }
    } main {
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        long k = sc.nextLong();
        boolean[] one = new boolean[s.length()];
        int num = 0;
        for (int i = 0; i < s.length(); i++) {
            if (i == 0) {
                if (s.charAt(i) == '1')
                    one[i] = true;
            } else {
                one[i] = s.charAt(i) == '1' && one[i - 1];
            }

            if (num == 0 && s.charAt(i) != '1')
                num = s.charAt(i) - '0';
        }
        if (k > one.length) {
            System.out.println(num);
        } else {
            if (one[(int) (k - 1)])
                System.out.println(1);
            else
                System.out.println(num);
        }
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String s = sc.next(); s sc.next() sc.next sc long k = sc.nextLong(); k sc.nextLong() sc.nextLong sc boolean[] one = new boolean[s.length()]; one new boolean[s.length()] s.length() s.length s int num = 0; num 0 for (int i = 0; i < s.length(); i++) {
            if (i == 0) {
                if (s.charAt(i) == '1')
                    one[i] = true;
            } else {
                one[i] = s.charAt(i) == '1' && one[i - 1];
            }

            if (num == 0 && s.charAt(i) != '1')
                num = s.charAt(i) - '0';
        } int i = 0; int i = 0; i 0 i < s.length() i s.length() s.length s i++ i++ i {
            if (i == 0) {
                if (s.charAt(i) == '1')
                    one[i] = true;
            } else {
                one[i] = s.charAt(i) == '1' && one[i - 1];
            }

            if (num == 0 && s.charAt(i) != '1')
                num = s.charAt(i) - '0';
        } {
            if (i == 0) {
                if (s.charAt(i) == '1')
                    one[i] = true;
            } else {
                one[i] = s.charAt(i) == '1' && one[i - 1];
            }

            if (num == 0 && s.charAt(i) != '1')
                num = s.charAt(i) - '0';
        } if (i == 0) {
                if (s.charAt(i) == '1')
                    one[i] = true;
            } else {
                one[i] = s.charAt(i) == '1' && one[i - 1];
            } i == 0 i 0 {
                if (s.charAt(i) == '1')
                    one[i] = true;
            } if (s.charAt(i) == '1')
                    one[i] = true; s.charAt(i) == '1' s.charAt(i) s.charAt s i '1' one[i] = true one[i] one i true {
                one[i] = s.charAt(i) == '1' && one[i - 1];
            } one[i] = s.charAt(i) == '1' && one[i - 1] one[i] one i s.charAt(i) == '1' && one[i - 1] s.charAt(i) == '1' s.charAt(i) s.charAt s i '1' one[i - 1] one i - 1 i 1 if (num == 0 && s.charAt(i) != '1')
                num = s.charAt(i) - '0'; num == 0 && s.charAt(i) != '1' num == 0 num 0 s.charAt(i) != '1' s.charAt(i) s.charAt s i '1' num = s.charAt(i) - '0' num s.charAt(i) - '0' s.charAt(i) s.charAt s i '0' if (k > one.length) {
            System.out.println(num);
        } else {
            if (one[(int) (k - 1)])
                System.out.println(1);
            else
                System.out.println(num);
        } k > one.length k one.length one one.length {
            System.out.println(num);
        } System.out.println(num) System.out.println System.out System System.out num {
            if (one[(int) (k - 1)])
                System.out.println(1);
            else
                System.out.println(num);
        } if (one[(int) (k - 1)])
                System.out.println(1);
            else
                System.out.println(num); one[(int) (k - 1)] one (int) (k - 1) k 1 System.out.println(1) System.out.println System.out System System.out 1 System.out.println(num) System.out.println System.out System System.out num String args[] args public class Main {

    public static void main(String args[]) {
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        long k = sc.nextLong();
        boolean[] one = new boolean[s.length()];
        int num = 0;
        for (int i = 0; i < s.length(); i++) {
            if (i == 0) {
                if (s.charAt(i) == '1')
                    one[i] = true;
            } else {
                one[i] = s.charAt(i) == '1' && one[i - 1];
            }

            if (num == 0 && s.charAt(i) != '1')
                num = s.charAt(i) - '0';
        }
        if (k > one.length) {
            System.out.println(num);
        } else {
            if (one[(int) (k - 1)])
                System.out.println(1);
            else
                System.out.println(num);
        }
    }

} public class Main {

    public static void main(String args[]) {
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        long k = sc.nextLong();
        boolean[] one = new boolean[s.length()];
        int num = 0;
        for (int i = 0; i < s.length(); i++) {
            if (i == 0) {
                if (s.charAt(i) == '1')
                    one[i] = true;
            } else {
                one[i] = s.charAt(i) == '1' && one[i - 1];
            }

            if (num == 0 && s.charAt(i) != '1')
                num = s.charAt(i) - '0';
        }
        if (k > one.length) {
            System.out.println(num);
        } else {
            if (one[(int) (k - 1)])
                System.out.println(1);
            else
                System.out.println(num);
        }
    }

} 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 = sc.nextLong();
        boolean[] one = new boolean[s.length()];
        int num = 0;
        for (int i = 0; i < s.length(); i++) {
            if (i == 0) {
                if (s.charAt(i) == '1')
                    one[i] = true;
            } else {
                one[i] = s.charAt(i) == '1' && one[i - 1];
            }

            if (num == 0 && s.charAt(i) != '1')
                num = s.charAt(i) - '0';
        }
        if (k > one.length) {
            System.out.println(num);
        } else {
            if (one[(int) (k - 1)])
                System.out.println(1);
            else
                System.out.println(num);
        }
    }

}
