import java.util.*;

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

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