#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define fore(b,c) for(int val0=b;val0<c;val0++)
#define forr(k,c,s) for(int k=c;k<s;k++)
#define pb push_back
#define mmp make_pair
using namespace __gnu_pbds;
using namespace std;
template<typename T>
using oset = tree<T,null_type,less<T>,rb_tree_tag,tree_order_statistics_node_update>;

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
typedef pair<int,int> ii;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ii> vii;
typedef vector<vi> vvi;
typedef long double ld;
typedef vector<vii> al;
typedef vector<ll> vl;
const int INF = 1e9;
const ll INFL = 1LL<<61;
const ll MN = 3030;
const ll LG = 13;
const ll M = 998244353;
ll dp[MN][MN];
ll ds(ll n, ll k) {
	if(k > n) {return 0;}
	if(k == n) {return 1;}
	if(n == 0 || k == 0) {return 0;}
	if(dp[n][k] != -1) {return dp[n][k];
	}
	//cout << "roop " << n << " " << k << '\n';
	ll res = ds(n-1,k-1) + ds(n,2*k);
	res %= M;
	return dp[n][k] = res;
}
int main() {
	//ios::sync_with_stdio(0);cout.precision(20);cout.tie(0);cin.tie(0);
	memset(dp,-1,sizeof(dp));
	ll n,k;
	cin >> n >> k;
	cout << ds(n,k) << '\n';
}

//#pragma GCC optimize(2)
#include<cstdio>
#include<iostream>
#include<string>
#include<cstring>
#include<map>
#include<cmath>
#include<cctype>
#include<vector>
#include<set>
#include<queue>
#include<algorithm>
#include<sstream>
#include<ctime>
#include<cstdlib>
#define X first
#define Y second
#define L (u<<1)
#define R (u<<1|1)
#define pb push_back
#define mk make_pair
#define Mid (tr[u].l+tr[u].r>>1)
#define Len(u) (tr[u].r-tr[u].l+1)
#define random(a,b) ((a)+rand()%((b)-(a)+1))
#define db puts("---")
using namespace std;

//void rd_cre() { freopen("d://dp//data.txt","w",stdout); srand(time(NULL)); }
//void rd_ac() { freopen("d://dp//data.txt","r",stdin); freopen("d://dp//AC.txt","w",stdout); }
//void rd_wa() { freopen("d://dp//data.txt","r",stdin); freopen("d://dp//WA.txt","w",stdout); }

typedef long long LL;
typedef unsigned long long ULL;
typedef pair<int,int> PII;

const int N=1000010,mod=1e9+7,INF=0x3f3f3f3f;
const double eps=1e-6;

int n;
LL f[110][2];

int main()
{
//	ios::sync_with_stdio(false);
//	cin.tie(0);

    scanf("%d",&n);
    f[0][1]=f[0][0]=1;
    for(int i=1;i<=n;i++)
    {
        char s[20]; scanf("%s",s+1);
        if(s[1]=='A')
        {
            f[i][0]=2*f[i-1][0]+f[i-1][1];
            f[i][1]=f[i-1][1];
        }
        else
        {
            f[i][0]=f[i-1][0];
            f[i][1]=2*f[i-1][1]+f[i-1][0];
        }
    }
    printf("%lld\n",f[n][1]);





















	return 0;
}
/*

*/








