import Data.List
import qualified Data.IntSet as ISet
import Data.Tuple
import Data.Bool

main = do
    ss <- getLine
    [x,y] <- map read . words <$> getLine
    let (xs,ys) = accum ss [0] [0]
        xs' = solve xs
        ys' = solve ys
    putStrLn . bool "No" "Yes" $ any (==x) xs' && any (==y) ys'

accum [] as bs = (as,bs)
accum ('T':ss) as bs = swap $ accum ss (0:bs) as
accum ('F':ss) (a:as') bs = accum ss ((a+1):as') bs

solve ns = ISet.elems . foldl' expand (ISet.singleton n) $ ns'
    where
        n = head ns
        ns' = filter (/=0) ns

expand :: ISet.IntSet -> Int -> ISet.IntSet
expand ns x
    | ISet.null ns = ISet.empty
    | otherwise = ISet.union (ISet.map (+x) ns) (ISet.map (subtract x) ns)
