#include int main() { int n; char c; while (scanf(" %d %c", &n, &c) == 2) { if (n == 1) { printf("1\n"); continue; } if (c == 'N') { if (n == 2) printf("1\n"); else printf("2\n"); } else if (c == 'R' || c == 'B') { printf("%d\n", n); } else printf("4\n"); } return 0; }