//https://atcoder.jp/contests/abc106/tasks/abc106_c

import java.io.*;

class Main{
    public static void main(String[] args) throws IOException{
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String S = br.readLine();
        String str = br.readLine();
        long K = Long.parseLong(str);
        String ans = "0";
        for (int i=0;i<K;i++){
            if (!String.valueOf(S.charAt(i)).equals("1")){
                ans = String.valueOf(S.charAt(i));
                break;
            }
        }
        if (ans.equals("0")){
            ans = "1";
        }
        System.out.println(ans);
    }
} import java.io.*; io.* java class Main{
    public static void main(String[] args) throws IOException{
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String S = br.readLine();
        String str = br.readLine();
        long K = Long.parseLong(str);
        String ans = "0";
        for (int i=0;i<K;i++){
            if (!String.valueOf(S.charAt(i)).equals("1")){
                ans = String.valueOf(S.charAt(i));
                break;
            }
        }
        if (ans.equals("0")){
            ans = "1";
        }
        System.out.println(ans);
    }
} Main public static void main(String[] args) throws IOException{
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String S = br.readLine();
        String str = br.readLine();
        long K = Long.parseLong(str);
        String ans = "0";
        for (int i=0;i<K;i++){
            if (!String.valueOf(S.charAt(i)).equals("1")){
                ans = String.valueOf(S.charAt(i));
                break;
            }
        }
        if (ans.equals("0")){
            ans = "1";
        }
        System.out.println(ans);
    } main {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String S = br.readLine();
        String str = br.readLine();
        long K = Long.parseLong(str);
        String ans = "0";
        for (int i=0;i<K;i++){
            if (!String.valueOf(S.charAt(i)).equals("1")){
                ans = String.valueOf(S.charAt(i));
                break;
            }
        }
        if (ans.equals("0")){
            ans = "1";
        }
        System.out.println(ans);
    } BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); br new BufferedReader(new InputStreamReader(System.in)) String S = br.readLine(); S br.readLine() br.readLine br String str = br.readLine(); str br.readLine() br.readLine br long K = Long.parseLong(str); K Long.parseLong(str) Long.parseLong Long str String ans = "0"; ans "0" for (int i=0;i<K;i++){
            if (!String.valueOf(S.charAt(i)).equals("1")){
                ans = String.valueOf(S.charAt(i));
                break;
            }
        } int i=0; int i=0; i 0 i<K i K i++ i++ i {
            if (!String.valueOf(S.charAt(i)).equals("1")){
                ans = String.valueOf(S.charAt(i));
                break;
            }
        } {
            if (!String.valueOf(S.charAt(i)).equals("1")){
                ans = String.valueOf(S.charAt(i));
                break;
            }
        } if (!String.valueOf(S.charAt(i)).equals("1")){
                ans = String.valueOf(S.charAt(i));
                break;
            } !String.valueOf(S.charAt(i)).equals("1") String.valueOf(S.charAt(i)).equals("1") String.valueOf(S.charAt(i)).equals String.valueOf(S.charAt(i)) String.valueOf String S.charAt(i) S.charAt S i "1" {
                ans = String.valueOf(S.charAt(i));
                break;
            } ans = String.valueOf(S.charAt(i)) ans String.valueOf(S.charAt(i)) String.valueOf String S.charAt(i) S.charAt S i break; if (ans.equals("0")){
            ans = "1";
        } ans.equals("0") ans.equals ans "0" {
            ans = "1";
        } ans = "1" ans "1" System.out.println(ans) System.out.println System.out System System.out ans String[] args args
//https://atcoder.jp/contests/abc106/tasks/abc106_c

import java.io.*;

class Main{
    public static void main(String[] args) throws IOException{
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String S = br.readLine();
        String str = br.readLine();
        long K = Long.parseLong(str);
        String ans = "0";
        for (int i=0;i<K;i++){
            if (!String.valueOf(S.charAt(i)).equals("1")){
                ans = String.valueOf(S.charAt(i));
                break;
            }
        }
        if (ans.equals("0")){
            ans = "1";
        }
        System.out.println(ans);
    }
}