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

string s;
long long k, cnt = 0;

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