import java.util.*;
import java.lang.Character;

public class Main{
    public static void main(String args[]){
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        float k = sc.nextFloat();
        int ans = 0;
        
        int j = 0;
        while(s.charAt(j) == '1'){
            ans = 1;
            if(j >= s.length()-1 || j >= k){
                break;
            }
            j++;
        }
        if(j < k){
            ans = Character.getNumericValue(s.charAt(j));
        }
        System.out.println(ans);
    }
} import java.util.*; util.* java import java.lang.Character; Character java.lang public class Main{
    public static void main(String args[]){
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        float k = sc.nextFloat();
        int ans = 0;
        
        int j = 0;
        while(s.charAt(j) == '1'){
            ans = 1;
            if(j >= s.length()-1 || j >= k){
                break;
            }
            j++;
        }
        if(j < k){
            ans = Character.getNumericValue(s.charAt(j));
        }
        System.out.println(ans);
    }
} Main public static void main(String args[]){
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        float k = sc.nextFloat();
        int ans = 0;
        
        int j = 0;
        while(s.charAt(j) == '1'){
            ans = 1;
            if(j >= s.length()-1 || j >= k){
                break;
            }
            j++;
        }
        if(j < k){
            ans = Character.getNumericValue(s.charAt(j));
        }
        System.out.println(ans);
    } main {
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        float k = sc.nextFloat();
        int ans = 0;
        
        int j = 0;
        while(s.charAt(j) == '1'){
            ans = 1;
            if(j >= s.length()-1 || j >= k){
                break;
            }
            j++;
        }
        if(j < k){
            ans = Character.getNumericValue(s.charAt(j));
        }
        System.out.println(ans);
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String s = sc.next(); s sc.next() sc.next sc float k = sc.nextFloat(); k sc.nextFloat() sc.nextFloat sc int ans = 0; ans 0 int j = 0; j 0 while(s.charAt(j) == '1'){
            ans = 1;
            if(j >= s.length()-1 || j >= k){
                break;
            }
            j++;
        } s.charAt(j) == '1' s.charAt(j) s.charAt s j '1' {
            ans = 1;
            if(j >= s.length()-1 || j >= k){
                break;
            }
            j++;
        } ans = 1 ans 1 if(j >= s.length()-1 || j >= k){
                break;
            } j >= s.length()-1 || j >= k j >= s.length()-1 j s.length()-1 s.length() s.length s 1 j >= k j k {
                break;
            } break; j++ j if(j < k){
            ans = Character.getNumericValue(s.charAt(j));
        } j < k j k {
            ans = Character.getNumericValue(s.charAt(j));
        } ans = Character.getNumericValue(s.charAt(j)) ans Character.getNumericValue(s.charAt(j)) Character.getNumericValue Character s.charAt(j) s.charAt s j System.out.println(ans) System.out.println System.out System System.out ans String args[] args public class Main{
    public static void main(String args[]){
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        float k = sc.nextFloat();
        int ans = 0;
        
        int j = 0;
        while(s.charAt(j) == '1'){
            ans = 1;
            if(j >= s.length()-1 || j >= k){
                break;
            }
            j++;
        }
        if(j < k){
            ans = Character.getNumericValue(s.charAt(j));
        }
        System.out.println(ans);
    }
} public class Main{
    public static void main(String args[]){
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        float k = sc.nextFloat();
        int ans = 0;
        
        int j = 0;
        while(s.charAt(j) == '1'){
            ans = 1;
            if(j >= s.length()-1 || j >= k){
                break;
            }
            j++;
        }
        if(j < k){
            ans = Character.getNumericValue(s.charAt(j));
        }
        System.out.println(ans);
    }
} Main
import java.util.*;
import java.lang.Character;

public class Main{
    public static void main(String args[]){
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        float k = sc.nextFloat();
        int ans = 0;
        
        int j = 0;
        while(s.charAt(j) == '1'){
            ans = 1;
            if(j >= s.length()-1 || j >= k){
                break;
            }
            j++;
        }
        if(j < k){
            ans = Character.getNumericValue(s.charAt(j));
        }
        System.out.println(ans);
    }
}