import Control.Monad
import Data.ByteString.Char8
g `f` s spl
 |last spl=="R" = zipWith (\sp gp -> if ("sp"==(head spl)) && (gp>=1 && gp<=n) then gp+1 else gp) s g
 |otherwise = zipWith (\sp gp -> if ("sp"==(head spl)) && (gp>=1 && gp<=n) then gp-1 else gp) s g
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) (foldl (`f` s) g spell))
 