import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner std = new Scanner(System.in);
        String s = std.next();
        long k = std.nextLong();
        //  10^15
        String rest = s;
        long restLength = k;
        boolean countOne = false;
        while (rest.charAt(0) == '1') {
            rest = rest.replaceFirst("1", "");
            restLength--;
            if (restLength == 0) {
                countOne = true;
                break;
            }
        }

        if (countOne) {
            System.out.println(1);
        } else {
            System.out.println(rest.substring(0, 1));
        }
    }
} import java.util.Scanner; Scanner java.util public class Main {
    public static void main(String[] args) {
        Scanner std = new Scanner(System.in);
        String s = std.next();
        long k = std.nextLong();
        //  10^15
        String rest = s;
        long restLength = k;
        boolean countOne = false;
        while (rest.charAt(0) == '1') {
            rest = rest.replaceFirst("1", "");
            restLength--;
            if (restLength == 0) {
                countOne = true;
                break;
            }
        }

        if (countOne) {
            System.out.println(1);
        } else {
            System.out.println(rest.substring(0, 1));
        }
    }
} Main public static void main(String[] args) {
        Scanner std = new Scanner(System.in);
        String s = std.next();
        long k = std.nextLong();
        //  10^15
        String rest = s;
        long restLength = k;
        boolean countOne = false;
        while (rest.charAt(0) == '1') {
            rest = rest.replaceFirst("1", "");
            restLength--;
            if (restLength == 0) {
                countOne = true;
                break;
            }
        }

        if (countOne) {
            System.out.println(1);
        } else {
            System.out.println(rest.substring(0, 1));
        }
    } main {
        Scanner std = new Scanner(System.in);
        String s = std.next();
        long k = std.nextLong();
        //  10^15
        String rest = s;
        long restLength = k;
        boolean countOne = false;
        while (rest.charAt(0) == '1') {
            rest = rest.replaceFirst("1", "");
            restLength--;
            if (restLength == 0) {
                countOne = true;
                break;
            }
        }

        if (countOne) {
            System.out.println(1);
        } else {
            System.out.println(rest.substring(0, 1));
        }
    } Scanner std = new Scanner(System.in); std new Scanner(System.in) String s = std.next(); s std.next() std.next std long k = std.nextLong(); k std.nextLong() std.nextLong std String rest = s; rest s long restLength = k; restLength k boolean countOne = false; countOne false while (rest.charAt(0) == '1') {
            rest = rest.replaceFirst("1", "");
            restLength--;
            if (restLength == 0) {
                countOne = true;
                break;
            }
        } rest.charAt(0) == '1' rest.charAt(0) rest.charAt rest 0 '1' {
            rest = rest.replaceFirst("1", "");
            restLength--;
            if (restLength == 0) {
                countOne = true;
                break;
            }
        } rest = rest.replaceFirst("1", "") rest rest.replaceFirst("1", "") rest.replaceFirst rest "1" "" restLength-- restLength if (restLength == 0) {
                countOne = true;
                break;
            } restLength == 0 restLength 0 {
                countOne = true;
                break;
            } countOne = true countOne true break; if (countOne) {
            System.out.println(1);
        } else {
            System.out.println(rest.substring(0, 1));
        } countOne {
            System.out.println(1);
        } System.out.println(1) System.out.println System.out System System.out 1 {
            System.out.println(rest.substring(0, 1));
        } System.out.println(rest.substring(0, 1)) System.out.println System.out System System.out rest.substring(0, 1) rest.substring rest 0 1 String[] args args public class Main {
    public static void main(String[] args) {
        Scanner std = new Scanner(System.in);
        String s = std.next();
        long k = std.nextLong();
        //  10^15
        String rest = s;
        long restLength = k;
        boolean countOne = false;
        while (rest.charAt(0) == '1') {
            rest = rest.replaceFirst("1", "");
            restLength--;
            if (restLength == 0) {
                countOne = true;
                break;
            }
        }

        if (countOne) {
            System.out.println(1);
        } else {
            System.out.println(rest.substring(0, 1));
        }
    }
} public class Main {
    public static void main(String[] args) {
        Scanner std = new Scanner(System.in);
        String s = std.next();
        long k = std.nextLong();
        //  10^15
        String rest = s;
        long restLength = k;
        boolean countOne = false;
        while (rest.charAt(0) == '1') {
            rest = rest.replaceFirst("1", "");
            restLength--;
            if (restLength == 0) {
                countOne = true;
                break;
            }
        }

        if (countOne) {
            System.out.println(1);
        } else {
            System.out.println(rest.substring(0, 1));
        }
    }
} Main
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner std = new Scanner(System.in);
        String s = std.next();
        long k = std.nextLong();
        //  10^15
        String rest = s;
        long restLength = k;
        boolean countOne = false;
        while (rest.charAt(0) == '1') {
            rest = rest.replaceFirst("1", "");
            restLength--;
            if (restLength == 0) {
                countOne = true;
                break;
            }
        }

        if (countOne) {
            System.out.println(1);
        } else {
            System.out.println(rest.substring(0, 1));
        }
    }
}