#include <iostream>
#include <string>
using namespace std;

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