#[allow(unused_macros)]
macro_rules! debug {
  ($($e:expr), *) => {println!(concat!($(stringify!($e), " = {:?}\n"), *), $($e), *)}
}

use std::collections::HashSet;

fn main() {
  let s = get::chars();
  let (x,y) = get::tuple::<isize,isize>();

  let ss = group_by(&s,|x,y|x==y);
  let dx = if ss[0][0]=='F' {ss[0].len() as isize} else {0};

  let mut axis_x = true;
  let mut xs = HashSet::new();
  let mut ys = HashSet::new();
  xs.insert(dx);
  ys.insert(0);

  for s in ss.iter().skip_while(|s|s[0]=='F') {
    let l = s.len() as isize;
    match s[0] {
      'F' => {if axis_x {xs = xs.into_iter().flat_map(|k|vec![k-l,k+l]).collect::<HashSet<_>>()}
                   else {ys = ys.into_iter().flat_map(|k|vec![k-l,k+l]).collect::<HashSet<_>>()}},
      'T' => {if l%2==1 {axis_x = !axis_x}},
      _ => unreachable!()
    }
  }

  let ans = if xs.contains(&x) && ys.contains(&y) {"Yes"} else {"No"};
  println!("{}", ans)
}

fn group_by<T: PartialEq + Clone, F>(vec: &Vec<T>, f: F) -> Vec<Vec<T>> where F: Fn(&T, &T) -> bool {
  let l = vec.len();
  let mut gs = vec![];
  let mut g = vec![];
  for i in 0 .. l {
    g.push(vec[i].clone());
    if i < l-1 && !f(&vec[i], &vec[i+1]) {
      gs.push(g.clone());
      g.clear()
    }
  }
  gs.push(g.clone());
  gs
}

#[allow(dead_code)]
mod get {
  use std::io::*;
  use std::str::*;

  pub fn val<T: FromStr>() -> T {
    let mut buf = String::new();
    let s = stdin();
    s.lock().read_line(&mut buf).ok();
    buf.trim_right().parse::<T>().ok().unwrap()
  }

  pub fn vals<T: FromStr>(n: usize) -> Vec<T> {
    let mut vec: Vec<T> = vec![];
    for _ in 0 .. n {
      vec.push(val());
    }
    vec
  }

  pub fn tuple<T1: FromStr, T2: FromStr>() -> (T1, T2) {
    let mut buf = String::new();
    let s = stdin();
    s.lock().read_line(&mut buf).ok();
    let mut it = buf.trim_right().split_whitespace();
    let x = it.next().unwrap().parse::<T1>().ok().unwrap();
    let y = it.next().unwrap().parse::<T2>().ok().unwrap();
    (x, y)
  }

  pub fn tuples<T1: FromStr, T2: FromStr>(n: usize) -> Vec<(T1, T2)> {
    let mut vec: Vec<(T1, T2)> = vec![];
    for _ in 0 .. n {
      vec.push(tuple());
    }
    vec
  }

  pub fn tuple3<T1: FromStr, T2: FromStr, T3: FromStr>() -> (T1, T2, T3) {
    let mut buf = String::new();
    let s = stdin();
    s.lock().read_line(&mut buf).ok();
    let mut it = buf.trim_right().split_whitespace();
    let x = it.next().unwrap().parse::<T1>().ok().unwrap();
    let y = it.next().unwrap().parse::<T2>().ok().unwrap();
    let z = it.next().unwrap().parse::<T3>().ok().unwrap();
    (x, y, z)
  }

  pub fn tuple3s<T1: FromStr, T2: FromStr, T3: FromStr>(n: usize) -> Vec<(T1, T2, T3)> {
    let mut vec: Vec<(T1, T2, T3)> = vec![];
    for _ in 0 .. n {
      vec.push(tuple3());
    }
    vec
  }

  pub fn list<T: FromStr>() -> Vec<T> {
    let mut buf = String::new();
    let s = stdin();
    s.lock().read_line(&mut buf).ok();
    buf.trim_right().split_whitespace().map(|t| t.parse::<T>().ok().unwrap()).collect()
  }

  pub fn lists<T: FromStr>(h: usize) -> Vec<Vec<T>> {
    let mut mat: Vec<Vec<T>> = vec![];
    for _ in 0 .. h {
      mat.push(list());
    }
    mat
  }

  pub fn chars() -> Vec<char> {
    let mut buf = String::new();
    let s = stdin();
    s.lock().read_line(&mut buf).ok();
    buf.trim_right().chars().collect()
  }
}


Measured memory_bytes: 4352