#include<bits/stdc++.h> using namespace std; int k,n; int digit(int x,int y){ return x%10^y/10^(y-1); } int main(){ cin>>n>>k; cout<<digit(n,k); }