#include <bits/stdc++.h>
#define FASTIO
using namespace std;

using ll = long long;
using Vi = vector<int>;
using Vl = vector<ll>;
using Pii = pair<int, int>;
using Pll = pair<ll, ll>;

constexpr int I_INF = numeric_limits<int>::max();
constexpr ll L_INF = numeric_limits<ll>::max();

class Prints {
private:
    class __Prints {
    public:
        __Prints(const char* sep, const char* term) : sep(sep), term(term) {}
        template <class... Args>
        void operator()(Args&&... args) const { print(std::forward<Args>(args)...); }

    private:
        const char *sep, *term;
        void print() const { std::cout << term; }
        void print_rest() const { std::cout << term; }
        template <class T, class... Tail>
        void print(T&& head, Tail&&... tail) const { std::cout << head, print_rest(std::forward<Tail>(tail)...); }
        template <class T, class... Tail>
        void print_rest(T&& head, Tail&&... tail) const { std::cout << sep << head, print_rest(std::forward<Tail>(tail)...); }
    };

public:
    Prints() {}
    __Prints operator()(const char* sep = " ", const char* term = "\n") const { return __Prints(sep, term); }
    template <class T>
    void print_vec(const std::vector<T>& vec, const char* sep = " ", const char* term = "\n") const {
        const size_t sz = vec.size();
        for (size_t i = 0; i < sz; i++) std::cout << vec[i] << (i == sz - 1 ? term : sep);
    }
};

Prints prints;

//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

bool dp[16010];

void solve() {
    string S;
    cin >> S;
    ll X, Y;
    cin >> X >> Y;

    ll n = S.size();
    ll cnt = 0;
    Vl steps;
    for (ll i = 0; i < n; i++) {
        if (S[i] == 'F') {
            ++cnt;
        }
        else {
            steps.emplace_back(cnt);
            cnt = 0;
        }
    }
    if (cnt > 0) {
        steps.emplace_back(cnt);
    }

    ll a = steps[0];
    Vl xs, ys;
    for (ll i = 2; i < (ll)steps.size(); i += 2) {
        xs.emplace_back(steps[i]);
    }
    for (ll i = 1; i < (ll)steps.size(); i += 2) {
        ys.emplace_back(steps[i]);
    }

    ll nx = xs.size();
    ll ny = ys.size();

    bool ok = true;
    constexpr ll sht = 8005;
    ll sum = 0;
    for (ll i = 0; i < nx; i++) {
        sum += xs[i];
    }
    dp[sht + a + sum] = true;
    for (ll i = 0; i < nx; i++) {
        for (ll j = 0; j < 16010; j++) {
            if (j + xs[i] * 2 < 16010) {
                dp[j] |= dp[j + xs[i] * 2];
            }
        }
    }

    if (!dp[X + sht]) {
        ok = false;
    }


    for (ll j = 0; j < 16010; j++) {
        dp[j] = false;
    }
    sum = 0;
    for (ll i = 0; i < ny; i++) {
        sum += ys[i];
    }
    dp[sht + sum] = true;
    for (ll i = 0; i < ny; i++) {
        for (ll j = 0; j < 16010; j++) {
            if (j + ys[i] * 2 < 16010) {
                dp[j] |= dp[j + ys[i] * 2];
            }
        }
    }

    if (!dp[Y + sht]) {
        ok = false;
    }

    cout << (ok ? "Yes\n" : "No\n");
}

//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

int main() {
#ifdef FASTIO
    cin.tie(0), cout.tie(0);
    ios::sync_with_stdio(false);
#endif
#ifdef FILEINPUT
    ifstream ifs("./in_out/input.txt");
    cin.rdbuf(ifs.rdbuf());
#endif
#ifdef FILEOUTPUT
    ofstream ofs("./in_out/output.txt");
    cout.rdbuf(ofs.rdbuf());
#endif
    cout << setprecision(18) << fixed;
    solve();
    cout << flush;
    return 0;
}

Measured memory_bytes: 3660