#include<iostream>
#include<string>
using namespace std;
int main(){
	string s;
	long long k;
	cin >> s >> k;
	int num_of_1 = 0;
	while(s[num_of_1] == '1') num_of_1++;
	if(k<=num_of_1) cout << 1 << endl;
	else cout << s[num_of_1] << endl;
}