#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
#define range(i, l, r) for(long long int (i) = (l); (i) < (r); (i)++)
#define reversed_range(i, l, r) for (long long int (i) = (r) - 1; (i) >= l; (i)--)
using namespace std;
template <typename T>
using vec = vector<T>;
using lint = long long;
using ulint = unsigned long long;
using pint = pair<int, int>;
using plint = pair<lint, lint>;

template <typename S, typename T>
ostream& operator <<(ostream& os, pair<S, T> p) {
    os << "(";
    os << p.first << ", " << p.second;
    return os << ")";
}

template <typename T>
ostream& operator <<(ostream& os, vec<T> v) {
    os << "[";
    if (v.size() == 0) return os << "]";
    for (int i = 0; i < v.size() - 1; i++) {
        os << v.at(i) << ", ";
    }
    return os << v.at(v.size() - 1) << "]";
}

template <typename T>
ostream& operator <<(ostream& os, set<T>& s) {
    os << "{";
    if (s.begin() == s.end()) return os << "}";
    auto it_first_item = s.begin();
    cout << *it_first_item;
    for (auto it = ++it_first_item; it != s.end(); it++) {
        cout << ", " << *it;
    }
    return cout << "}";
}

template <typename T>
ostream& operator <<(ostream& os, unordered_set<T>& s) {
    os << "{";
    if (s.begin() == s.end()) return os << "}";
    auto it_first_item = s.begin();
    cout << *it_first_item;
    for (auto it = ++it_first_item; it != s.end(); it++) {
        cout << ", " << *it;
    }
    return cout << "}";
}

template <typename K, typename V>
ostream& operator <<(ostream& os, map<K, V> m) {
    os << "{";
    if (m.begin() == m.end()) return os << "}";
    auto it_first_item = m.begin();
    cout << it_first_item->first << ": " << it_first_item->second;
    for (auto it = ++it_first_item; it != m.end(); it++) {
        cout << ", " << it->first << ": " << it->second;
    }
    return os << "}";
}

template <typename K, typename V>
ostream& operator <<(ostream& os, unordered_map<K, V> m) {
    os << "{";
    if (m.begin() == m.end()) return os << "}";
    auto it_first_item = m.begin();
    cout << it_first_item->first << ": " << it_first_item->second;
    for (auto it = ++it_first_item; it != m.end(); it++) {
        cout << ", " << it->first << ": " << it->second;
    }
    return os << "}";
}

lint pow(lint num, lint e, lint MOD) {
    lint res = 1;
    lint cur_num = num;
    while (e) {
        if (e & 1) {
            res *= cur_num;
            res %= MOD;
        }
        cur_num *= cur_num;
        cur_num %= MOD;
        e >>= 1;
    }
    return res;
}

int main() {
    cin.tie(0); cout.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(10);
    string s; cin >> s;
    lint x, y; cin >> x >> y;

    lint first_x_moves = 0;
    lint cur_idx = 0;
    while (cur_idx < s.size() and s.at(cur_idx) == 'F') {
        first_x_moves += 1;
        cur_idx += 1;
    }
    if (first_x_moves > 0) x -= first_x_moves;
    vec<lint> x_moves, y_moves;
    bool is_horizontal = true;
    lint cur_count = 0;
    range(i, cur_idx, s.size()) {
        char command = s.at(i);
        if (command == 'F') cur_count += 1;
        else if (cur_count > 0) {
            if (is_horizontal) x_moves.emplace_back(cur_count);
            else y_moves.emplace_back(cur_count);
            cur_count = 0;
            is_horizontal = (is_horizontal ? false : true);
        }
        else is_horizontal = (is_horizontal ? false : true);
    }
    if (cur_count > 0) {
        if (is_horizontal) x_moves.emplace_back(cur_count);
        else y_moves.emplace_back(cur_count);
    }

    unordered_set<lint> possible_coords_x, possible_coords_y;
    possible_coords_x.emplace(0); possible_coords_y.emplace(0);
    range(i, 0, x_moves.size()) {
        lint num_moves = x_moves.at(i);
        unordered_set<lint> new_p_cs;
        for (const auto& c : possible_coords_x) {
            new_p_cs.emplace(c + num_moves);
            new_p_cs.emplace(c - num_moves);
        }
        possible_coords_x = new_p_cs;
    }
    range(i, 0, y_moves.size()) {
        lint num_moves = y_moves.at(i);
        unordered_set<lint> new_p_cs;
        for (const auto& c : possible_coords_y) {
            new_p_cs.emplace(c + num_moves);
            new_p_cs.emplace(c - num_moves);
        }
        possible_coords_y = new_p_cs;
    }
    // cout << s.size() << "\n";
    // cout << x_moves << "\n";
    // cout << y_moves << "\n";
    // cout << possible_coords_x << "\n";
    // cout << possible_coords_y << "\n";
    cout << (possible_coords_x.count(x) and possible_coords_y.count(y) ? "Yes" : "No") << "\n";
}

Measured memory_bytes: 896