#include "bits/stdc++.h"
using namespace std;
 
int main() {
	
	string s;
	cin >> s;
	long long l1 = 0;
	while (l1 < s.size() && s[l1] == '1') l1++;
	
	long long k;
	cin >> k;
	if (l1 >= k) cout << 1 << endl;
	else cout << s[l1] << endl;
	
}
