module IntSet = Set.Make (struct
  type t = int
  let compare = compare
end)

let array_of_string s = Array.init (String.length s) (fun i -> s.[i])

let solve xs ns =
  snd (List.fold_left (fun (m, s) n ->
    (m - n, IntSet.fold (fun x s ->
      [(x + n); (x - n)]
      |> List.filter (( >= ) (m - n))
      |> List.fold_left (fun s x -> IntSet.add x s) s) s IntSet.empty))
    (List.fold_left ( + ) 0 ns, xs) ns)

let () =
  let s = Scanf.scanf "%s\n" (fun s -> s) in
  let x, y = Scanf.scanf "%d %d\n" (fun x y -> x, y) in
  array_of_string s
  |> Array.fold_left (fun (acc, curr) c ->
      match c with
      | 'F' -> (acc, curr + 1)
      | 'T' -> (curr :: acc, 0)) ([], 0)
  |> (fun (acc, curr) -> List.rev (curr :: acc))
  |> (function (n :: ns) ->
      let (_, (xs, ys)) =
        List.fold_left (fun (b, (xs, ys)) x ->
          (not b, if b then (x :: xs, ys) else (xs, x :: ys))) (false, ([], [])) ns in
      IntSet.mem 0 (solve (IntSet.singleton (n - x)) (List.rev xs))
        && IntSet.mem 0 (solve (IntSet.singleton (-y)) (List.rev ys)))
  |> (function true -> "Yes" | false -> "No")
  |> print_endline