//g++ 6.cpp -std=c++14 -O2 -I . #include using namespace std; #include using namespace atcoder; using ll = long long; using ld = long double; using vi = vector; using vvi = vector; using vll = vector; using vvll = vector; using vld = vector; using vvld = vector; using vst = vector; using vvst = vector; #define fi first #define se second #define pb push_back #define pq_big(T) priority_queue,less> #define pq_small(T) priority_queue,greater> #define all(a) a.begin(),a.end() #define rep(i,start,end) for(ll i=start;i<(ll)(end);i++) #define per(i,start,end) for(ll i=start;i>=(ll)(end);i--) #define uniq(a) sort(all(a));a.erase(unique(all(a)),a.end()) using mint = modint998244353; constexpr ll mod = 998244353; // xC4 mint c4(ll x){ mint res=1; rep(i,0,4){ res*=x-i; res/=i+1; } return res; } int main(){ ios::sync_with_stdio(false); cin.tie(nullptr); ll n; int x; cin>>n>>x; mint ans=0; ll r=0,b=0; vector> s(x); rep(i,0,x){ char c; ll v; cin>>c>>v; s[i]={c,v}; if(c=='R')r+=v; if(c=='B')b+=v; } if(r%2==1||b%2==1){ cout<<0<