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 <- B.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)
    putStrLn $ if dp x y es os then "Yes" else "No"

ps (i,bs)
    | B.null bs = if i==0 then Nothing else Just(i, (0,B.empty))
    | B.head bs == 'F' = ps (i+1, B.tail bs)
    | otherwise = Just (i, (0, B.tail bs))

dp tx ty (x:xs) (y:ys) = runST $ do
    ar <- newArray ((0,(-8000)),(8000,8000)) False::ST s (STUArray s (Int,Int) Bool)
    writeArray ar (0,x) True
    forM_ [(iv,j)|iv<-zip [1..] xs,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)
    xf <- readArray ar (length xs, tx)
    writeArray ar (0,x) False
    writeArray ar (0,y) True
    forM_ [(iv,j)|iv<-zip [1..] ys,j<-[(-my)..my]] $ \((i,v),j) -> do
        f1 <- if j-v>=(-my) then readArray ar (i-1,j-v) else return False
        f2 <- if j+v<=my then readArray ar (i-1,j+v) else return False
        writeArray ar (i,j) (f1 || f2)
    yf <- readArray ar (length ys, ty)
    return (xf && yf)
    where
        mx = sum (x:xs)
        my = sum (y:ys)
