import Control.Monad
fr spell n sp gp= if ("sp"==(spell!!0!!0)) && (gp>=1 && gp<=n) then gp+1 else gp
fl spell n sp gp= if ("sp"==(spell!!0!!0)) && (gp>=1 && gp<=n) then gp-1 else gp
f spell s g n
 |null spell = g
 |(spell!!0!!1)=="R" = f (drop 1 spell) s (zipWith (fr spell n) s g) n
 |otherwise = f (drop 1 spell) s (zipWith (fl spell n) s g) n
main=do
 [n,q]<-map read.words<$>getLine
 s<-getLine
 let g = [1..n]
 spell<-map words<$>replicateM q getLine
 print$length$filter (>=1) (filter (<=n) (f spell s g n))