#include #include using namespace std; void kingDance(int s){ if ( s == 1) cout << 1<< endl; else cout << 4 << endl; } void knightDance(int s){ if ( s == 1 || s == 2 ) cout << 1 << endl; else cout << 2 << endl; } void rookDance(int s){ if ( s == 1 ){ cout << 1 << endl; return; } if ( s% 2 == 1 ) cout << s+1<< endl; else cout << s << endl; } void bishopDance(int s ) { cout << s << endl; } int main(int argc, char** argv) { int s; while ( cin >> s ){ char dance; cin >> dance; switch(dance) { case 'K': { kingDance(s); break; } case 'N': { knightDance(s); break; } case 'B': { bishopDance(s); break; } case 'R': { rookDance(s); break; } } } return 0; }