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 maxIndex = s.length();
        if(Long.parseLong(k) < s.length()){
            maxIndex = Integer.parseInt(k);
        }

        boolean isOne = true;
        int printIndex = 0;
        for(printIndex = 0; printIndex < maxIndex; printIndex++){
            if(s.charAt(printIndex) != ('1')){
                isOne = false;
                break;
            }
        }
        if(isOne){
            System.out.println("1");
        }else{
            System.out.println(s.charAt(printIndex));
        }
    }
} 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 maxIndex = s.length();
        if(Long.parseLong(k) < s.length()){
            maxIndex = Integer.parseInt(k);
        }

        boolean isOne = true;
        int printIndex = 0;
        for(printIndex = 0; printIndex < maxIndex; printIndex++){
            if(s.charAt(printIndex) != ('1')){
                isOne = false;
                break;
            }
        }
        if(isOne){
            System.out.println("1");
        }else{
            System.out.println(s.charAt(printIndex));
        }
    }
} Main public static void main(String args[]){
        
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        String k = sc.next();
        
        int maxIndex = s.length();
        if(Long.parseLong(k) < s.length()){
            maxIndex = Integer.parseInt(k);
        }

        boolean isOne = true;
        int printIndex = 0;
        for(printIndex = 0; printIndex < maxIndex; printIndex++){
            if(s.charAt(printIndex) != ('1')){
                isOne = false;
                break;
            }
        }
        if(isOne){
            System.out.println("1");
        }else{
            System.out.println(s.charAt(printIndex));
        }
    } main {
        
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        String k = sc.next();
        
        int maxIndex = s.length();
        if(Long.parseLong(k) < s.length()){
            maxIndex = Integer.parseInt(k);
        }

        boolean isOne = true;
        int printIndex = 0;
        for(printIndex = 0; printIndex < maxIndex; printIndex++){
            if(s.charAt(printIndex) != ('1')){
                isOne = false;
                break;
            }
        }
        if(isOne){
            System.out.println("1");
        }else{
            System.out.println(s.charAt(printIndex));
        }
    } 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 maxIndex = s.length(); maxIndex s.length() s.length s if(Long.parseLong(k) < s.length()){
            maxIndex = Integer.parseInt(k);
        } Long.parseLong(k) < s.length() Long.parseLong(k) Long.parseLong Long k s.length() s.length s {
            maxIndex = Integer.parseInt(k);
        } maxIndex = Integer.parseInt(k) maxIndex Integer.parseInt(k) Integer.parseInt Integer k boolean isOne = true; isOne true int printIndex = 0; printIndex 0 for(printIndex = 0; printIndex < maxIndex; printIndex++){
            if(s.charAt(printIndex) != ('1')){
                isOne = false;
                break;
            }
        } printIndex = 0; printIndex = 0 printIndex 0 printIndex < maxIndex printIndex maxIndex printIndex++ printIndex++ printIndex {
            if(s.charAt(printIndex) != ('1')){
                isOne = false;
                break;
            }
        } {
            if(s.charAt(printIndex) != ('1')){
                isOne = false;
                break;
            }
        } if(s.charAt(printIndex) != ('1')){
                isOne = false;
                break;
            } s.charAt(printIndex) != ('1') s.charAt(printIndex) s.charAt s printIndex ('1') {
                isOne = false;
                break;
            } isOne = false isOne false break; if(isOne){
            System.out.println("1");
        }else{
            System.out.println(s.charAt(printIndex));
        } isOne {
            System.out.println("1");
        } System.out.println("1") System.out.println System.out System System.out "1" {
            System.out.println(s.charAt(printIndex));
        } System.out.println(s.charAt(printIndex)) System.out.println System.out System System.out s.charAt(printIndex) s.charAt s printIndex 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 maxIndex = s.length();
        if(Long.parseLong(k) < s.length()){
            maxIndex = Integer.parseInt(k);
        }

        boolean isOne = true;
        int printIndex = 0;
        for(printIndex = 0; printIndex < maxIndex; printIndex++){
            if(s.charAt(printIndex) != ('1')){
                isOne = false;
                break;
            }
        }
        if(isOne){
            System.out.println("1");
        }else{
            System.out.println(s.charAt(printIndex));
        }
    }
} public class Main{
    public static void main(String args[]){
        
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        String k = sc.next();
        
        int maxIndex = s.length();
        if(Long.parseLong(k) < s.length()){
            maxIndex = Integer.parseInt(k);
        }

        boolean isOne = true;
        int printIndex = 0;
        for(printIndex = 0; printIndex < maxIndex; printIndex++){
            if(s.charAt(printIndex) != ('1')){
                isOne = false;
                break;
            }
        }
        if(isOne){
            System.out.println("1");
        }else{
            System.out.println(s.charAt(printIndex));
        }
    }
} 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 maxIndex = s.length();
        if(Long.parseLong(k) < s.length()){
            maxIndex = Integer.parseInt(k);
        }

        boolean isOne = true;
        int printIndex = 0;
        for(printIndex = 0; printIndex < maxIndex; printIndex++){
            if(s.charAt(printIndex) != ('1')){
                isOne = false;
                break;
            }
        }
        if(isOne){
            System.out.println("1");
        }else{
            System.out.println(s.charAt(printIndex));
        }
    }
}
