#[allow(unused_imports)]
use std::cmp::{max, min, Ordering};
#[allow(unused_imports)]
use std::collections::{BTreeMap, BTreeSet, BinaryHeap, HashMap, HashSet, VecDeque};
#[allow(unused_imports)]
use std::iter::FromIterator;
#[allow(unused_imports)]
use std::io::stdin;

mod util {
    use std::io::stdin;
    use std::str::FromStr;
    use std::fmt::Debug;

    #[allow(dead_code)]
    pub fn line() -> String {
        let mut line: String = String::new();
        stdin().read_line(&mut line).unwrap();
        line.trim().to_string()
    }

    #[allow(dead_code)]
    pub fn gets<T: FromStr>() -> Vec<T>
    where
        <T as FromStr>::Err: Debug,
    {
        let mut line: String = String::new();
        stdin().read_line(&mut line).unwrap();
        line.split_whitespace()
            .map(|t| t.parse().unwrap())
            .collect()
    }
}

#[allow(unused_macros)]
macro_rules! get {
    ($t:ty) => {
        {
            let mut line: String = String::new();
            stdin().read_line(&mut line).unwrap();
            line.trim().parse::<$t>().unwrap()
        }
    };
    ($($t:ty),*) => {
        {
            let mut line: String = String::new();
            stdin().read_line(&mut line).unwrap();
            let mut iter = line.split_whitespace();
            (
                $(iter.next().unwrap().parse::<$t>().unwrap(),)*
            )
        }
    };
    ($t:ty; $n:expr) => {
        (0..$n).map(|_|
                    get!($t)
                   ).collect::<Vec<_>>()
    };
    ($($t:ty),*; $n:expr) => {
        (0..$n).map(|_|
                    get!($($t),*)
                   ).collect::<Vec<_>>()
    };
    ($t:ty ;;) => {
        {
            let mut line: String = String::new();
            stdin().read_line(&mut line).unwrap();
            line.split_whitespace()
                .map(|t| t.parse::<$t>().unwrap())
                .collect::<Vec<_>>()
        }
    };
}

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

fn main() {
    let s: Vec<char> = util::line().chars().collect();
    let (mut x, y) = get!(i64, i64);

    let mut op = Vec::new();
    let mut f = 0;
    for &c in &s {
        if c == 'F' {
            f += 1;
        } else {
            op.push(f);
            f = 0;
        }
    }
    op.push(f);

    x -= op[0];
    op.remove(0);

    let mut v = Vec::new();
    let mut h = Vec::new();

    for (i, &p) in op.iter().enumerate() {
        if i % 2 == 0 {
            v.push(p);
        } else {
            h.push(p);
        }
    }

    let mut vv = HashSet::new();
    vv.insert(0);

    for &p in &v {
        let mut next = HashSet::new();
        for &prev in &vv {
            if (prev + p) < y + s.len() as i64 {
                next.insert(prev + p);
            }
            if (prev - p) > y - s.len() as i64 {
                next.insert(prev - p);
            }
        }
        vv = next;
    }

    let mut hh = HashSet::new();
    hh.insert(0);
    for &p in &h {
        let mut next = HashSet::new();
        for &prev in &hh {
            if (prev + p) < x + s.len() as i64 {
                next.insert(prev + p);
            }
            if (prev - p) > x - s.len() as i64 {
                next.insert(prev - p);
            }
        }
        hh = next;
    }

    if vv.contains(&y) && hh.contains(&x) {
        println!("Yes");
    } else {
        println!("No");
    }
}


Measured memory_bytes: 4476