#include #include #include using namespace std; struct point { int x; int y; }; int main(int argc, char** argv) { std::ios::sync_with_stdio(false); int s; char c; while(cin >> s >> c){ if(c == 'R'){ cout << s << endl; } else if(c == 'N') { if(s <= 2) cout << 1 << endl; else cout << 2 << endl; } else if(c == 'B'){ cout << s << endl; } else if(c == 'K'){ if( s < 2) cout << 1 << endl; else cout << 4 << endl; } } return 0; }