import Data.List
import Data.Array
import Data.Array.ST
import Control.Monad
import Control.Monad.ST
import qualified Data.ByteString.Char8 as B

main = do
    s <- getLine
    (x:y:_) <- map read.words<$>getLine::IO[Int]
    let (es,os) = (\(es,os)-> (map snd es, 0:map snd os)) $ partition (even.fst) $ zip [0..] $ unfoldr ps (0,s)
    let xdp = dp x (sum es) es
    let ydp = dp y (sum os) os
    putStrLn $ if xdp && ydp then "Yes" else "No"

ps (0,[]) = Nothing
ps (i,[]) = Just(i, (0,[]))
ps (i, 'F':ss) = ps (i+1,ss)
ps (i, 'T':ss) = Just (i, (0, ss))

dp t mx (n:ns) = runST $ do
    ar <- newArray ((0,(-mx)),(length ns,mx)) False::ST s (STArray s (Int,Int) Bool)
    writeArray ar (0,n) True
    forM_ [(iv,j)|iv<-zip [1..] ns,j<-[(-mx)..mx]] $ \((i,v),j) -> do
        f1 <- if j-v>=(-mx) then readArray ar (i-1,j-v) else return False
        f2 <- if j+v<=mx then readArray ar (i-1,j+v) else return False
        writeArray ar (i,j) (f1 || f2)
    readArray ar (length ns, t)