#include <bits/stdc++.h>
using namespace std;
int main()
{
long long int i,k=0,l;
int j=0;
string s;
cin>>s;
cin>>i;

for( j;j<100;j++)
{if(s[j]=='1')
k++;
if(s[j]!='1')
break;

}
if(k>=i)
cout<<1;
else
cout<<s[j];
}
