import java.util.*;
import static java.lang.Math.*;

public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        long k = sc.nextLong();
        int memo = 0;
        while(s.length()>memo && s.charAt(memo)=='1'){ 
            memo++;
        }
        System.out.println(k-1<memo? '1':s.charAt(memo));
    }
} import java.util.*; util.* java import static java.lang.Math.*; import static java.lang.Math.*; import static java.lang.Math.*; public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        long k = sc.nextLong();
        int memo = 0;
        while(s.length()>memo && s.charAt(memo)=='1'){ 
            memo++;
        }
        System.out.println(k-1<memo? '1':s.charAt(memo));
    }
} Main public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        long k = sc.nextLong();
        int memo = 0;
        while(s.length()>memo && s.charAt(memo)=='1'){ 
            memo++;
        }
        System.out.println(k-1<memo? '1':s.charAt(memo));
    } main {
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        long k = sc.nextLong();
        int memo = 0;
        while(s.length()>memo && s.charAt(memo)=='1'){ 
            memo++;
        }
        System.out.println(k-1<memo? '1':s.charAt(memo));
    } 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 int memo = 0; memo 0 while(s.length()>memo && s.charAt(memo)=='1'){ 
            memo++;
        } s.length()>memo && s.charAt(memo)=='1' s.length()>memo s.length() s.length s memo s.charAt(memo)=='1' s.charAt(memo) s.charAt s memo '1' { 
            memo++;
        } memo++ memo System.out.println(k-1<memo? '1':s.charAt(memo)) System.out.println System.out System System.out k-1<memo? '1':s.charAt(memo) k-1<memo k-1 k 1 memo '1' s.charAt(memo) s.charAt s memo 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();
        int memo = 0;
        while(s.length()>memo && s.charAt(memo)=='1'){ 
            memo++;
        }
        System.out.println(k-1<memo? '1':s.charAt(memo));
    }
} public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        long k = sc.nextLong();
        int memo = 0;
        while(s.length()>memo && s.charAt(memo)=='1'){ 
            memo++;
        }
        System.out.println(k-1<memo? '1':s.charAt(memo));
    }
} Main
import java.util.*;
import static java.lang.Math.*;

public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        long k = sc.nextLong();
        int memo = 0;
        while(s.length()>memo && s.charAt(memo)=='1'){ 
            memo++;
        }
        System.out.println(k-1<memo? '1':s.charAt(memo));
    }
}