#include #include int arr[1001]; int main() { int S; char perf; while (scanf("%d %c\n", &S, &perf) == 2) { int cnt; switch (perf) { case 'K': if (S == 1) { cnt = 1; } else { cnt = 4; } break; case 'N': if (S <= 2) { cnt = 1; } else { cnt = 2; } break; case 'B': cnt = S; break; case 'R': cnt = S; break; default: return 1; } printf("%d\n", cnt); } return 0; }