<?php
list($n,$q)=explode(" ",trim(fgets(STDIN)));
$s=str_split("0".trim(fgets(STDIN)));
$g=array_fill(0,$n+2,1);
$i=0;
while($i<$q){
  list($t,$d)=explode(" ",trim(fgets(STDIN)));
  $arr=array_keys($s,$t);
  if($d=="L"){
    $m=-1;
  }else{
    $m=1;
  }
  foreach($arr as $k =>$v){
    $g[$v+$m]+=$g[$v];
    $g[$v]=0;
  }
  unset($arr);
  ++$i;
}
unset($g[0]);
unset($g[$n+1]);
echo array_sum($g);