#include <iostream>
using namespace std;
signed main() {
int N;
cin >> N;
cout << (N / 1000) % 10;
return 0;
}
#include <iostream>
using namespace std;
signed main() {
int N;
cin >> N;
cout << (N / 1000) % 10;
return 0;
}