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

import Debug.Trace

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

accum ss as bs = (reverse as',reverse bs')
    where (as',bs') = accum' ss as bs

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:ns') = 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)
