import java.util.*;
import java.util.stream.*;

public class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        String s = in.nextLine();
        long k = in.nextLong();
        int pos = 0;
        while(pos < s.length() && s.charAt(pos) == '1') pos++;
        if(k <= pos) {
            System.out.println(1);
        } else {
            System.out.println(s.charAt(pos));
        }
    }
} import java.util.*; util.* java import java.util.stream.*; stream.* java.util public class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        String s = in.nextLine();
        long k = in.nextLong();
        int pos = 0;
        while(pos < s.length() && s.charAt(pos) == '1') pos++;
        if(k <= pos) {
            System.out.println(1);
        } else {
            System.out.println(s.charAt(pos));
        }
    }
} Main public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        String s = in.nextLine();
        long k = in.nextLong();
        int pos = 0;
        while(pos < s.length() && s.charAt(pos) == '1') pos++;
        if(k <= pos) {
            System.out.println(1);
        } else {
            System.out.println(s.charAt(pos));
        }
    } main {
        Scanner in = new Scanner(System.in);
        String s = in.nextLine();
        long k = in.nextLong();
        int pos = 0;
        while(pos < s.length() && s.charAt(pos) == '1') pos++;
        if(k <= pos) {
            System.out.println(1);
        } else {
            System.out.println(s.charAt(pos));
        }
    } Scanner in = new Scanner(System.in); in new Scanner(System.in) String s = in.nextLine(); s in.nextLine() in.nextLine in long k = in.nextLong(); k in.nextLong() in.nextLong in int pos = 0; pos 0 while(pos < s.length() && s.charAt(pos) == '1') pos++; pos < s.length() && s.charAt(pos) == '1' pos < s.length() pos s.length() s.length s s.charAt(pos) == '1' s.charAt(pos) s.charAt s pos '1' pos++ pos if(k <= pos) {
            System.out.println(1);
        } else {
            System.out.println(s.charAt(pos));
        } k <= pos k pos {
            System.out.println(1);
        } System.out.println(1) System.out.println System.out System System.out 1 {
            System.out.println(s.charAt(pos));
        } System.out.println(s.charAt(pos)) System.out.println System.out System System.out s.charAt(pos) s.charAt s pos String[] args args public class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        String s = in.nextLine();
        long k = in.nextLong();
        int pos = 0;
        while(pos < s.length() && s.charAt(pos) == '1') pos++;
        if(k <= pos) {
            System.out.println(1);
        } else {
            System.out.println(s.charAt(pos));
        }
    }
} public class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        String s = in.nextLine();
        long k = in.nextLong();
        int pos = 0;
        while(pos < s.length() && s.charAt(pos) == '1') pos++;
        if(k <= pos) {
            System.out.println(1);
        } else {
            System.out.println(s.charAt(pos));
        }
    }
} Main
import java.util.*;
import java.util.stream.*;

public class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        String s = in.nextLine();
        long k = in.nextLong();
        int pos = 0;
        while(pos < s.length() && s.charAt(pos) == '1') pos++;
        if(k <= pos) {
            System.out.println(1);
        } else {
            System.out.println(s.charAt(pos));
        }
    }
}
