import java.util.Scanner;
import java.util.Arrays;
 
public class Main{
    public static void main(String[]args){
      Scanner sc = new Scanner(System.in);
      String s = sc.nextLine();
      Long n = sc.nextLong();
      boolean found = false;
      int ans = 0;
      for(int i = 0;i < Math.min(s.length(),n);i++){
          if(s.charAt(i) != '1'){
              ans = Character.getNumericValue(s.charAt(i));
              found = true;
           	  System.out.println(ans);
              break;
          }
      }
      //sが全て1のとき
      if(!found){System.out.println('1');}
    }  
} import java.util.Scanner; Scanner java.util import java.util.Arrays; Arrays java.util public class Main{
    public static void main(String[]args){
      Scanner sc = new Scanner(System.in);
      String s = sc.nextLine();
      Long n = sc.nextLong();
      boolean found = false;
      int ans = 0;
      for(int i = 0;i < Math.min(s.length(),n);i++){
          if(s.charAt(i) != '1'){
              ans = Character.getNumericValue(s.charAt(i));
              found = true;
           	  System.out.println(ans);
              break;
          }
      }
      //sが全て1のとき
      if(!found){System.out.println('1');}
    }  
} Main public static void main(String[]args){
      Scanner sc = new Scanner(System.in);
      String s = sc.nextLine();
      Long n = sc.nextLong();
      boolean found = false;
      int ans = 0;
      for(int i = 0;i < Math.min(s.length(),n);i++){
          if(s.charAt(i) != '1'){
              ans = Character.getNumericValue(s.charAt(i));
              found = true;
           	  System.out.println(ans);
              break;
          }
      }
      //sが全て1のとき
      if(!found){System.out.println('1');}
    } main {
      Scanner sc = new Scanner(System.in);
      String s = sc.nextLine();
      Long n = sc.nextLong();
      boolean found = false;
      int ans = 0;
      for(int i = 0;i < Math.min(s.length(),n);i++){
          if(s.charAt(i) != '1'){
              ans = Character.getNumericValue(s.charAt(i));
              found = true;
           	  System.out.println(ans);
              break;
          }
      }
      //sが全て1のとき
      if(!found){System.out.println('1');}
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String s = sc.nextLine(); s sc.nextLine() sc.nextLine sc Long n = sc.nextLong(); n sc.nextLong() sc.nextLong sc boolean found = false; found false int ans = 0; ans 0 for(int i = 0;i < Math.min(s.length(),n);i++){
          if(s.charAt(i) != '1'){
              ans = Character.getNumericValue(s.charAt(i));
              found = true;
           	  System.out.println(ans);
              break;
          }
      } int i = 0; int i = 0; i 0 i < Math.min(s.length(),n) i Math.min(s.length(),n) Math.min Math s.length() s.length s n i++ i++ i {
          if(s.charAt(i) != '1'){
              ans = Character.getNumericValue(s.charAt(i));
              found = true;
           	  System.out.println(ans);
              break;
          }
      } {
          if(s.charAt(i) != '1'){
              ans = Character.getNumericValue(s.charAt(i));
              found = true;
           	  System.out.println(ans);
              break;
          }
      } if(s.charAt(i) != '1'){
              ans = Character.getNumericValue(s.charAt(i));
              found = true;
           	  System.out.println(ans);
              break;
          } s.charAt(i) != '1' s.charAt(i) s.charAt s i '1' {
              ans = Character.getNumericValue(s.charAt(i));
              found = true;
           	  System.out.println(ans);
              break;
          } ans = Character.getNumericValue(s.charAt(i)) ans Character.getNumericValue(s.charAt(i)) Character.getNumericValue Character s.charAt(i) s.charAt s i found = true found true System.out.println(ans) System.out.println System.out System System.out ans break; if(!found){System.out.println('1');} !found found {System.out.println('1');} System.out.println('1') System.out.println System.out System System.out '1' String[]args args public class Main{
    public static void main(String[]args){
      Scanner sc = new Scanner(System.in);
      String s = sc.nextLine();
      Long n = sc.nextLong();
      boolean found = false;
      int ans = 0;
      for(int i = 0;i < Math.min(s.length(),n);i++){
          if(s.charAt(i) != '1'){
              ans = Character.getNumericValue(s.charAt(i));
              found = true;
           	  System.out.println(ans);
              break;
          }
      }
      //sが全て1のとき
      if(!found){System.out.println('1');}
    }  
} public class Main{
    public static void main(String[]args){
      Scanner sc = new Scanner(System.in);
      String s = sc.nextLine();
      Long n = sc.nextLong();
      boolean found = false;
      int ans = 0;
      for(int i = 0;i < Math.min(s.length(),n);i++){
          if(s.charAt(i) != '1'){
              ans = Character.getNumericValue(s.charAt(i));
              found = true;
           	  System.out.println(ans);
              break;
          }
      }
      //sが全て1のとき
      if(!found){System.out.println('1');}
    }  
} Main
import java.util.Scanner;
import java.util.Arrays;
 
public class Main{
    public static void main(String[]args){
      Scanner sc = new Scanner(System.in);
      String s = sc.nextLine();
      Long n = sc.nextLong();
      boolean found = false;
      int ans = 0;
      for(int i = 0;i < Math.min(s.length(),n);i++){
          if(s.charAt(i) != '1'){
              ans = Character.getNumericValue(s.charAt(i));
              found = true;
           	  System.out.println(ans);
              break;
          }
      }
      //sが全て1のとき
      if(!found){System.out.println('1');}
    }  
}