Scanf.scanf "%s %d %d" (fun s x y ->
    let len = String.length s in
    let rec loop i dir first cur xl yl =
        if i = len then (
            if cur > 0 then (
                if first < 0 then cur, xl, yl else
                if dir then first, (cur :: xl), yl
                       else first, xl, (cur :: yl)
            ) else first, xl, yl
        ) else (
            if s.[i] = 'F' then loop (i + 1) dir first (cur + 1) xl yl else
                let first, xl, yl =
                    if cur > 0 then (
                        if first < 0 then cur, xl, yl else
                        if dir then first, (cur :: xl), yl
                               else first, xl, (cur :: yl)
                    ) else max first cur, xl, yl
                in
                loop (i + 1) (not dir) first 0 xl yl
        )
    in
    let fx, xl, yl = loop 0 true (-1) 0 [] [] in
    let judge p l =
        let a = Array.make 8192 false in
        a.(0) <- true;
        List.iter (fun v ->
            for j = 8191 downto v do
                a.(j) <- a.(j) || a.(j - v)
            done
        ) l;
        let sum = List.fold_left (+) 0 l in
        let rec loop i =
            if i = 8192 then false else
                if a.(i) && abs (sum - i * 2) = abs p then true else loop (i + 1)
        in
        loop 0
    in
    print_endline @@ if judge (x - fx) xl && judge y yl then "Yes" else "No"
)