import java.util.Scanner;
public class Main{
public static void main(String[] args){
Scanner sc = new Scanner(System.in);
  String r = sc.next();
  char[] a = r.toCharArray();
  String s = sc.next();
  long n = Long.parseLong(s);
  boolean b = true;
  char c = 'a';
  out:
  for(int i = 0;i < r.length();i++){
    c = a[i];
    if(c != '1'){
      if(n < i+1){
        break out;
      }
      else{
      b = false;
      break out;
      }
    }
  }
  System.out.println(b? "1":c);
}
}
       import java.util.Scanner; Scanner java.util public class Main{
public static void main(String[] args){
Scanner sc = new Scanner(System.in);
  String r = sc.next();
  char[] a = r.toCharArray();
  String s = sc.next();
  long n = Long.parseLong(s);
  boolean b = true;
  char c = 'a';
  out:
  for(int i = 0;i < r.length();i++){
    c = a[i];
    if(c != '1'){
      if(n < i+1){
        break out;
      }
      else{
      b = false;
      break out;
      }
    }
  }
  System.out.println(b? "1":c);
}
} Main public static void main(String[] args){
Scanner sc = new Scanner(System.in);
  String r = sc.next();
  char[] a = r.toCharArray();
  String s = sc.next();
  long n = Long.parseLong(s);
  boolean b = true;
  char c = 'a';
  out:
  for(int i = 0;i < r.length();i++){
    c = a[i];
    if(c != '1'){
      if(n < i+1){
        break out;
      }
      else{
      b = false;
      break out;
      }
    }
  }
  System.out.println(b? "1":c);
} main {
Scanner sc = new Scanner(System.in);
  String r = sc.next();
  char[] a = r.toCharArray();
  String s = sc.next();
  long n = Long.parseLong(s);
  boolean b = true;
  char c = 'a';
  out:
  for(int i = 0;i < r.length();i++){
    c = a[i];
    if(c != '1'){
      if(n < i+1){
        break out;
      }
      else{
      b = false;
      break out;
      }
    }
  }
  System.out.println(b? "1":c);
} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String r = sc.next(); r sc.next() sc.next sc char[] a = r.toCharArray(); a r.toCharArray() r.toCharArray r String s = sc.next(); s sc.next() sc.next sc long n = Long.parseLong(s); n Long.parseLong(s) Long.parseLong Long s boolean b = true; b true char c = 'a'; c 'a' System.out.println(b? "1":c) System.out.println System.out System System.out b? "1":c b "1" c String[] args args public class Main{
public static void main(String[] args){
Scanner sc = new Scanner(System.in);
  String r = sc.next();
  char[] a = r.toCharArray();
  String s = sc.next();
  long n = Long.parseLong(s);
  boolean b = true;
  char c = 'a';
  out:
  for(int i = 0;i < r.length();i++){
    c = a[i];
    if(c != '1'){
      if(n < i+1){
        break out;
      }
      else{
      b = false;
      break out;
      }
    }
  }
  System.out.println(b? "1":c);
}
} public class Main{
public static void main(String[] args){
Scanner sc = new Scanner(System.in);
  String r = sc.next();
  char[] a = r.toCharArray();
  String s = sc.next();
  long n = Long.parseLong(s);
  boolean b = true;
  char c = 'a';
  out:
  for(int i = 0;i < r.length();i++){
    c = a[i];
    if(c != '1'){
      if(n < i+1){
        break out;
      }
      else{
      b = false;
      break out;
      }
    }
  }
  System.out.println(b? "1":c);
}
} Main
import java.util.Scanner;
public class Main{
public static void main(String[] args){
Scanner sc = new Scanner(System.in);
  String r = sc.next();
  char[] a = r.toCharArray();
  String s = sc.next();
  long n = Long.parseLong(s);
  boolean b = true;
  char c = 'a';
  out:
  for(int i = 0;i < r.length();i++){
    c = a[i];
    if(c != '1'){
      if(n < i+1){
        break out;
      }
      else{
      b = false;
      break out;
      }
    }
  }
  System.out.println(b? "1":c);
}
}
      