#include <iostream>
#include <cstdio>
#include <algorithm>
#define MAX 101
using namespace std;

char s[MAX];
long long k;
int main() {
    while(~scanf("%s%lld",s,&k)) {
        int one = 0;
        while(s[one] && s[one] == '1') one ++;
        if(one >= k) printf("1\n");
        else printf("%c\n",s[one]);
    }
}
