#include #include #define rep(i, n) for (int i = 0; i < (n); i++) #define all(a) (a).begin(), (a).end() using namespace std; using namespace atcoder; typedef long long ll; typedef pair P; typedef pair Pll; typedef tuple Tll; template using min_priority_queue = priority_queue, greater>; const double PI = 3.14159265358979323846; int ddx[] = {1, -1, 0, 0, 1, 1, -1, -1}; int ddy[] = {0, 0, 1, -1, 1, -1, 1, -1}; int dx[] = {1, 0, -1, 0}; int dy[] = {0, 1, 0, -1}; void cans(bool f) { if (f) cout << "Yes" << endl; else cout << "No" << endl; } template T gcd(T a, T b) { if (b == 0) return a; else return gcd(b, a % b); } bool compare1(pair a, pair b) { return a.first < b.first; } bool compare2(pair a, pair b) { return a.second < b.second; } long long modpow(long long a, long long n, long long mod = 998244353) { long long res = 1; while (n > 0) { if (n & 1) res = res * a % mod; a = a * a % mod; n >>= 1; } return res; } template bool chmax(T& a, const T& b) { if (a < b) { a = b; // aをbで更新 return true; } return false; } template bool chmin(T& a, const T& b) { if (a > b) { a = b; // aをbで更新 return true; } return false; } using mint = modint998244353; const int MAX = 510000; const int MOD = 998244353; long long fac[MAX], finv[MAX], inv[MAX]; // テーブルを作る前処理 void COMinit() { fac[0] = fac[1] = 1; finv[0] = finv[1] = 1; inv[1] = 1; for (int i = 2; i < MAX; i++) { fac[i] = fac[i - 1] * i % MOD; inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD; finv[i] = finv[i - 1] * inv[i] % MOD; } } // 二項係数計算 long long COM(int n, int k) { if (n < k) return 0; if (n < 0 || k < 0) return 0; return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD; } int main() { int N; string S; cin >> N; cin >> S; ll no = 0; for (auto c : S) { if (c == 'A' || c == 'B') no++; } COMinit(); cout << COM(N, no) << endl; }