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 =
  List.fold_left (fun s n ->
    IntSet.fold (fun x s ->
      IntSet.add (x + n) (IntSet.add (x - n) s)) s IntSet.empty) 

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 x (solve (IntSet.singleton n) (List.rev xs))
        && IntSet.mem y (solve (IntSet.singleton 0) (List.rev ys)))
  |> (function true -> "Yes" | false -> "No")
  |> print_endline