#include <iostream>
#include <cmath>

using namespace std;

int main() {
    string s;
    cin>>s;
    int k;
    cin>>k;
    int i = 0;
    while(s[i] == '1') i++;
    if (k <= i) cout << 1 << endl; else cout << s[i] << endl;
    return 0;
}
