import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        String k = sc.next();
        int count = 0;
        for(char c: s.toCharArray()) {
            count++;
            if(c != '1') {
                System.out.println(c);
                return;
            }
            if(k.length() <= 3 && Integer.parseInt(k) == count) {
                System.out.println(c);
                return;
            }
        }
    }
} import java.util.Scanner; Scanner java.util public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        String k = sc.next();
        int count = 0;
        for(char c: s.toCharArray()) {
            count++;
            if(c != '1') {
                System.out.println(c);
                return;
            }
            if(k.length() <= 3 && Integer.parseInt(k) == count) {
                System.out.println(c);
                return;
            }
        }
    }
} Main public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        String k = sc.next();
        int count = 0;
        for(char c: s.toCharArray()) {
            count++;
            if(c != '1') {
                System.out.println(c);
                return;
            }
            if(k.length() <= 3 && Integer.parseInt(k) == count) {
                System.out.println(c);
                return;
            }
        }
    } main {
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        String k = sc.next();
        int count = 0;
        for(char c: s.toCharArray()) {
            count++;
            if(c != '1') {
                System.out.println(c);
                return;
            }
            if(k.length() <= 3 && Integer.parseInt(k) == count) {
                System.out.println(c);
                return;
            }
        }
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String s = sc.next(); s sc.next() sc.next sc String k = sc.next(); k sc.next() sc.next sc int count = 0; count 0 for(char c: s.toCharArray()) {
            count++;
            if(c != '1') {
                System.out.println(c);
                return;
            }
            if(k.length() <= 3 && Integer.parseInt(k) == count) {
                System.out.println(c);
                return;
            }
        } char c s.toCharArray() s.toCharArray s {
            count++;
            if(c != '1') {
                System.out.println(c);
                return;
            }
            if(k.length() <= 3 && Integer.parseInt(k) == count) {
                System.out.println(c);
                return;
            }
        } {
            count++;
            if(c != '1') {
                System.out.println(c);
                return;
            }
            if(k.length() <= 3 && Integer.parseInt(k) == count) {
                System.out.println(c);
                return;
            }
        } count++ count if(c != '1') {
                System.out.println(c);
                return;
            } c != '1' c '1' {
                System.out.println(c);
                return;
            } System.out.println(c) System.out.println System.out System System.out c return; if(k.length() <= 3 && Integer.parseInt(k) == count) {
                System.out.println(c);
                return;
            } k.length() <= 3 && Integer.parseInt(k) == count k.length() <= 3 k.length() k.length k 3 Integer.parseInt(k) == count Integer.parseInt(k) Integer.parseInt Integer k count {
                System.out.println(c);
                return;
            } System.out.println(c) System.out.println System.out System System.out c return; String[] args args public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        String k = sc.next();
        int count = 0;
        for(char c: s.toCharArray()) {
            count++;
            if(c != '1') {
                System.out.println(c);
                return;
            }
            if(k.length() <= 3 && Integer.parseInt(k) == count) {
                System.out.println(c);
                return;
            }
        }
    }
} public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        String k = sc.next();
        int count = 0;
        for(char c: s.toCharArray()) {
            count++;
            if(c != '1') {
                System.out.println(c);
                return;
            }
            if(k.length() <= 3 && Integer.parseInt(k) == count) {
                System.out.println(c);
                return;
            }
        }
    }
} Main
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        String k = sc.next();
        int count = 0;
        for(char c: s.toCharArray()) {
            count++;
            if(c != '1') {
                System.out.println(c);
                return;
            }
            if(k.length() <= 3 && Integer.parseInt(k) == count) {
                System.out.println(c);
                return;
            }
        }
    }
}
