/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ /* * File: main.cpp * Author: cteam007 * * Created on October 28, 2017, 10:35 AM */ #include using namespace std; int n; string st; /* * */ int main() { while(cin>>n) { cin>>st; if(st=="B" || st=="R") { cout << n << endl; } else if(st=="K") { if(n==1){ cout << "1" << endl; } else{ cout << "4" << endl; } } else if(st=="N"){ if(n==1 || n == 2){ cout << "1" << endl; } else if(n>=3){ cout << "2" << endl; } } } return 0; }