import java.util.*;

class Main{
  public static void main(String args[]){
    Scanner sc = new Scanner(System.in);
    char[] str = sc.nextLine().toCharArray();
    long counter = sc.nextLong();
    
    int i = 0;
    while(str[i] == '1' && ++i<str.length);
    
    if(i>=counter) System.out.println(1);
    else System.out.println(str[i]);
  }
} import java.util.*; util.* java class Main{
  public static void main(String args[]){
    Scanner sc = new Scanner(System.in);
    char[] str = sc.nextLine().toCharArray();
    long counter = sc.nextLong();
    
    int i = 0;
    while(str[i] == '1' && ++i<str.length);
    
    if(i>=counter) System.out.println(1);
    else System.out.println(str[i]);
  }
} Main public static void main(String args[]){
    Scanner sc = new Scanner(System.in);
    char[] str = sc.nextLine().toCharArray();
    long counter = sc.nextLong();
    
    int i = 0;
    while(str[i] == '1' && ++i<str.length);
    
    if(i>=counter) System.out.println(1);
    else System.out.println(str[i]);
  } main {
    Scanner sc = new Scanner(System.in);
    char[] str = sc.nextLine().toCharArray();
    long counter = sc.nextLong();
    
    int i = 0;
    while(str[i] == '1' && ++i<str.length);
    
    if(i>=counter) System.out.println(1);
    else System.out.println(str[i]);
  } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) char[] str = sc.nextLine().toCharArray(); str sc.nextLine().toCharArray() sc.nextLine().toCharArray sc.nextLine() sc.nextLine sc long counter = sc.nextLong(); counter sc.nextLong() sc.nextLong sc int i = 0; i 0 while(str[i] == '1' && ++i<str.length); str[i] == '1' && ++i<str.length str[i] == '1' str[i] str i '1' ++i<str.length ++i i str.length str str.length if(i>=counter) System.out.println(1);
    else System.out.println(str[i]); i>=counter i counter System.out.println(1) System.out.println System.out System System.out 1 System.out.println(str[i]) System.out.println System.out System System.out str[i] str i String args[] args
import java.util.*;

class Main{
  public static void main(String args[]){
    Scanner sc = new Scanner(System.in);
    char[] str = sc.nextLine().toCharArray();
    long counter = sc.nextLong();
    
    int i = 0;
    while(str[i] == '1' && ++i<str.length);
    
    if(i>=counter) System.out.println(1);
    else System.out.println(str[i]);
  }
}