import java.util.ArrayList;
import java.util.*;
public class Main {
  static Scanner sc = new Scanner(System.in);  
  static String i = sc.next();
  static long iga1 = sc.nextLong();
  
  
 public static void main(String[] args) {
  if(i.length() > iga1 ){
   String iti = i.substring(0,(int)iga1);
   String[] itibara = iti.split("");
   itiiti1(iga1,itibara);
   }else{
     String[] itibara = i.split("");
     itiiti1(iga1,itibara);
   }
 }
 static void itiiti1(long iga11,String[] itibara){
  if(iga11 > 1000000000){
    long count = 0L;
    for(long ii = 0;ii < iga11; ii++){
      if (itibara[(int)ii].equals("1")){
        count+=1;
      }else{
        System.out.println(itibara[(int)ii]);
        break;
      }
      if(count == iga11){
        System.out.println("1");
      }
    }  
      
  }else{
   long count = 0L;
   for(long ii = 0;ii < iga11; ii++){
     if (itibara[(int)ii].equals("1")){
       count+=1;
     }else{
       System.out.println(itibara[(int)ii]);
       break;
     }
   }
   if(count == iga11){
     System.out.println("1");
   }
  }
 }
}
  import java.util.ArrayList; ArrayList java.util import java.util.*; util.* java public class Main {
  static Scanner sc = new Scanner(System.in);  
  static String i = sc.next();
  static long iga1 = sc.nextLong();
  
  
 public static void main(String[] args) {
  if(i.length() > iga1 ){
   String iti = i.substring(0,(int)iga1);
   String[] itibara = iti.split("");
   itiiti1(iga1,itibara);
   }else{
     String[] itibara = i.split("");
     itiiti1(iga1,itibara);
   }
 }
 static void itiiti1(long iga11,String[] itibara){
  if(iga11 > 1000000000){
    long count = 0L;
    for(long ii = 0;ii < iga11; ii++){
      if (itibara[(int)ii].equals("1")){
        count+=1;
      }else{
        System.out.println(itibara[(int)ii]);
        break;
      }
      if(count == iga11){
        System.out.println("1");
      }
    }  
      
  }else{
   long count = 0L;
   for(long ii = 0;ii < iga11; ii++){
     if (itibara[(int)ii].equals("1")){
       count+=1;
     }else{
       System.out.println(itibara[(int)ii]);
       break;
     }
   }
   if(count == iga11){
     System.out.println("1");
   }
  }
 }
} Main static Scanner sc = new Scanner(System.in); sc new Scanner(System.in) static String i = sc.next(); i sc.next() sc.next sc static long iga1 = sc.nextLong(); iga1 sc.nextLong() sc.nextLong sc public static void main(String[] args) {
  if(i.length() > iga1 ){
   String iti = i.substring(0,(int)iga1);
   String[] itibara = iti.split("");
   itiiti1(iga1,itibara);
   }else{
     String[] itibara = i.split("");
     itiiti1(iga1,itibara);
   }
 } main {
  if(i.length() > iga1 ){
   String iti = i.substring(0,(int)iga1);
   String[] itibara = iti.split("");
   itiiti1(iga1,itibara);
   }else{
     String[] itibara = i.split("");
     itiiti1(iga1,itibara);
   }
 } if(i.length() > iga1 ){
   String iti = i.substring(0,(int)iga1);
   String[] itibara = iti.split("");
   itiiti1(iga1,itibara);
   }else{
     String[] itibara = i.split("");
     itiiti1(iga1,itibara);
   } i.length() > iga1 i.length() i.length i iga1 {
   String iti = i.substring(0,(int)iga1);
   String[] itibara = iti.split("");
   itiiti1(iga1,itibara);
   } String iti = i.substring(0,(int)iga1); iti i.substring(0,(int)iga1) i.substring i 0 (int)iga1 String[] itibara = iti.split(""); itibara iti.split("") iti.split iti "" itiiti1(iga1,itibara) itiiti1 iga1 itibara {
     String[] itibara = i.split("");
     itiiti1(iga1,itibara);
   } String[] itibara = i.split(""); itibara i.split("") i.split i "" itiiti1(iga1,itibara) itiiti1 iga1 itibara String[] args args static void itiiti1(long iga11,String[] itibara){
  if(iga11 > 1000000000){
    long count = 0L;
    for(long ii = 0;ii < iga11; ii++){
      if (itibara[(int)ii].equals("1")){
        count+=1;
      }else{
        System.out.println(itibara[(int)ii]);
        break;
      }
      if(count == iga11){
        System.out.println("1");
      }
    }  
      
  }else{
   long count = 0L;
   for(long ii = 0;ii < iga11; ii++){
     if (itibara[(int)ii].equals("1")){
       count+=1;
     }else{
       System.out.println(itibara[(int)ii]);
       break;
     }
   }
   if(count == iga11){
     System.out.println("1");
   }
  }
 } itiiti1 {
  if(iga11 > 1000000000){
    long count = 0L;
    for(long ii = 0;ii < iga11; ii++){
      if (itibara[(int)ii].equals("1")){
        count+=1;
      }else{
        System.out.println(itibara[(int)ii]);
        break;
      }
      if(count == iga11){
        System.out.println("1");
      }
    }  
      
  }else{
   long count = 0L;
   for(long ii = 0;ii < iga11; ii++){
     if (itibara[(int)ii].equals("1")){
       count+=1;
     }else{
       System.out.println(itibara[(int)ii]);
       break;
     }
   }
   if(count == iga11){
     System.out.println("1");
   }
  }
 } if(iga11 > 1000000000){
    long count = 0L;
    for(long ii = 0;ii < iga11; ii++){
      if (itibara[(int)ii].equals("1")){
        count+=1;
      }else{
        System.out.println(itibara[(int)ii]);
        break;
      }
      if(count == iga11){
        System.out.println("1");
      }
    }  
      
  }else{
   long count = 0L;
   for(long ii = 0;ii < iga11; ii++){
     if (itibara[(int)ii].equals("1")){
       count+=1;
     }else{
       System.out.println(itibara[(int)ii]);
       break;
     }
   }
   if(count == iga11){
     System.out.println("1");
   }
  } iga11 > 1000000000 iga11 1000000000 {
    long count = 0L;
    for(long ii = 0;ii < iga11; ii++){
      if (itibara[(int)ii].equals("1")){
        count+=1;
      }else{
        System.out.println(itibara[(int)ii]);
        break;
      }
      if(count == iga11){
        System.out.println("1");
      }
    }  
      
  } long count = 0L; count 0L for(long ii = 0;ii < iga11; ii++){
      if (itibara[(int)ii].equals("1")){
        count+=1;
      }else{
        System.out.println(itibara[(int)ii]);
        break;
      }
      if(count == iga11){
        System.out.println("1");
      }
    } long ii = 0; long ii = 0; ii 0 ii < iga11 ii iga11 ii++ ii++ ii {
      if (itibara[(int)ii].equals("1")){
        count+=1;
      }else{
        System.out.println(itibara[(int)ii]);
        break;
      }
      if(count == iga11){
        System.out.println("1");
      }
    } {
      if (itibara[(int)ii].equals("1")){
        count+=1;
      }else{
        System.out.println(itibara[(int)ii]);
        break;
      }
      if(count == iga11){
        System.out.println("1");
      }
    } if (itibara[(int)ii].equals("1")){
        count+=1;
      }else{
        System.out.println(itibara[(int)ii]);
        break;
      } itibara[(int)ii].equals("1") itibara[(int)ii].equals itibara[(int)ii] itibara (int)ii "1" {
        count+=1;
      } count+=1 count 1 {
        System.out.println(itibara[(int)ii]);
        break;
      } System.out.println(itibara[(int)ii]) System.out.println System.out System System.out itibara[(int)ii] itibara (int)ii break; if(count == iga11){
        System.out.println("1");
      } count == iga11 count iga11 {
        System.out.println("1");
      } System.out.println("1") System.out.println System.out System System.out "1" {
   long count = 0L;
   for(long ii = 0;ii < iga11; ii++){
     if (itibara[(int)ii].equals("1")){
       count+=1;
     }else{
       System.out.println(itibara[(int)ii]);
       break;
     }
   }
   if(count == iga11){
     System.out.println("1");
   }
  } long count = 0L; count 0L for(long ii = 0;ii < iga11; ii++){
     if (itibara[(int)ii].equals("1")){
       count+=1;
     }else{
       System.out.println(itibara[(int)ii]);
       break;
     }
   } long ii = 0; long ii = 0; ii 0 ii < iga11 ii iga11 ii++ ii++ ii {
     if (itibara[(int)ii].equals("1")){
       count+=1;
     }else{
       System.out.println(itibara[(int)ii]);
       break;
     }
   } {
     if (itibara[(int)ii].equals("1")){
       count+=1;
     }else{
       System.out.println(itibara[(int)ii]);
       break;
     }
   } if (itibara[(int)ii].equals("1")){
       count+=1;
     }else{
       System.out.println(itibara[(int)ii]);
       break;
     } itibara[(int)ii].equals("1") itibara[(int)ii].equals itibara[(int)ii] itibara (int)ii "1" {
       count+=1;
     } count+=1 count 1 {
       System.out.println(itibara[(int)ii]);
       break;
     } System.out.println(itibara[(int)ii]) System.out.println System.out System System.out itibara[(int)ii] itibara (int)ii break; if(count == iga11){
     System.out.println("1");
   } count == iga11 count iga11 {
     System.out.println("1");
   } System.out.println("1") System.out.println System.out System System.out "1" long iga11 iga11 String[] itibara itibara public class Main {
  static Scanner sc = new Scanner(System.in);  
  static String i = sc.next();
  static long iga1 = sc.nextLong();
  
  
 public static void main(String[] args) {
  if(i.length() > iga1 ){
   String iti = i.substring(0,(int)iga1);
   String[] itibara = iti.split("");
   itiiti1(iga1,itibara);
   }else{
     String[] itibara = i.split("");
     itiiti1(iga1,itibara);
   }
 }
 static void itiiti1(long iga11,String[] itibara){
  if(iga11 > 1000000000){
    long count = 0L;
    for(long ii = 0;ii < iga11; ii++){
      if (itibara[(int)ii].equals("1")){
        count+=1;
      }else{
        System.out.println(itibara[(int)ii]);
        break;
      }
      if(count == iga11){
        System.out.println("1");
      }
    }  
      
  }else{
   long count = 0L;
   for(long ii = 0;ii < iga11; ii++){
     if (itibara[(int)ii].equals("1")){
       count+=1;
     }else{
       System.out.println(itibara[(int)ii]);
       break;
     }
   }
   if(count == iga11){
     System.out.println("1");
   }
  }
 }
} public class Main {
  static Scanner sc = new Scanner(System.in);  
  static String i = sc.next();
  static long iga1 = sc.nextLong();
  
  
 public static void main(String[] args) {
  if(i.length() > iga1 ){
   String iti = i.substring(0,(int)iga1);
   String[] itibara = iti.split("");
   itiiti1(iga1,itibara);
   }else{
     String[] itibara = i.split("");
     itiiti1(iga1,itibara);
   }
 }
 static void itiiti1(long iga11,String[] itibara){
  if(iga11 > 1000000000){
    long count = 0L;
    for(long ii = 0;ii < iga11; ii++){
      if (itibara[(int)ii].equals("1")){
        count+=1;
      }else{
        System.out.println(itibara[(int)ii]);
        break;
      }
      if(count == iga11){
        System.out.println("1");
      }
    }  
      
  }else{
   long count = 0L;
   for(long ii = 0;ii < iga11; ii++){
     if (itibara[(int)ii].equals("1")){
       count+=1;
     }else{
       System.out.println(itibara[(int)ii]);
       break;
     }
   }
   if(count == iga11){
     System.out.println("1");
   }
  }
 }
} Main
import java.util.ArrayList;
import java.util.*;
public class Main {
  static Scanner sc = new Scanner(System.in);  
  static String i = sc.next();
  static long iga1 = sc.nextLong();
  
  
 public static void main(String[] args) {
  if(i.length() > iga1 ){
   String iti = i.substring(0,(int)iga1);
   String[] itibara = iti.split("");
   itiiti1(iga1,itibara);
   }else{
     String[] itibara = i.split("");
     itiiti1(iga1,itibara);
   }
 }
 static void itiiti1(long iga11,String[] itibara){
  if(iga11 > 1000000000){
    long count = 0L;
    for(long ii = 0;ii < iga11; ii++){
      if (itibara[(int)ii].equals("1")){
        count+=1;
      }else{
        System.out.println(itibara[(int)ii]);
        break;
      }
      if(count == iga11){
        System.out.println("1");
      }
    }  
      
  }else{
   long count = 0L;
   for(long ii = 0;ii < iga11; ii++){
     if (itibara[(int)ii].equals("1")){
       count+=1;
     }else{
       System.out.println(itibara[(int)ii]);
       break;
     }
   }
   if(count == iga11){
     System.out.println("1");
   }
  }
 }
}
 
