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

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

let rec dfs m x y = function
  | [] -> x = 0 && y = 0
  | n :: ns ->
      abs x + abs y <= m && (dfs (m - n) (-y) (x + n) ns || dfs (m - n) y (-x - n) 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))
  |> (fun s -> dfs (List.fold_left ( + ) 0 s) (-x) (-y) s)
  |> (function true -> "Yes" | false -> "No")
  |> print_endline