#include <bits/stdc++.h>
using namespace std;
using ll = long long;

int main(int argc, char **argv)
{
	string str; ll k; cin >> str >> k; --k;

	ll i{0};
	while (str[i] == '1') {++i;}
	std::cout << str[min(k, i)]<< std::endl;
}