#include <bits/stdc++.h>

#define F first
#define S second
#define MP make_pair
#define pb push_back
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define LCM(a, b) (a) / __gcd((a), (b)) * (b)
#define CEIL(a, b) (a)/(b)+(((a)%(b))?1:0)
#define ln '\n'

using namespace std;
using LL = long long;
using ldouble = long double;
using P = pair<int, int>;
using LP = pair<LL, LL>;

static const int INF = INT_MAX;
static const LL LINF = LLONG_MAX;
static const int MIN = INT_MIN;
static const LL LMIN = LLONG_MIN;
static const int MOD = 1e9 + 7;
static const int SIZE = 200005;

const int dx[] = {0, -1, 1, 0};
const int dy[] = {-1, 0, 0, 1};

vector<LL> Div(LL n) {
    vector<LL> ret;
    for(LL i = 1; i * i <= n; ++i) {
        if(n % i == 0) {
            ret.pb(i);
            if(i * i != n) ret.pb(n / i);
        }
    }
    sort(all(ret));
    return ret;
}

bool dp_min[4005][8005], dp_pl[4005][8005];

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);

    string s;
    cin >> s;
    int x, y;
    cin >> x >> y;

    vector<int> ver, hor;
    bool f = true;
    int c = 0;
    int len = s.size();
    for(int i = 0; i < len; ++i) {
        if(s[i] == 'T') {
            if(f) {
                if(hor.empty()) {
                    dp_pl[1][c] = true;
                }
                hor.pb(c);
                f = false;
            } else {
                ver.pb(c);
                f = true;
            }
            c = 0;
        } else {
            ++c;
        }
    }

    if(f) {
        if(hor.empty()) dp_pl[1][c] = true;
        hor.pb(c);
    } else {
        ver.pb(c);
    }

    dp_pl[0][0] = dp_min[0][0] = true;
    for(int i = 1; i < hor.size(); ++i) {
        for(int j = 0; j <= 8000; ++j) {
            if(dp_pl[i][j]) {
                if(j - hor[i] < 0) {
                    dp_min[i + 1][hor[i] - j] = true;
                } else {
                    dp_pl[i + 1][j - hor[i]] = true;
                }
                dp_pl[i + 1][j + hor[i]] = true;
            }
            if(dp_min[i][j]) {
                dp_min[i + 1][j + hor[i]] = true;
                if(j - hor[i] < 0) {
                    dp_pl[i + 1][hor[i] - j] = true;
                } else {
                    dp_min[i + 1][j - hor[i]] = true;
                }
            }
        }
    }


    if(x > 0 && !dp_pl[hor.size()][x] ||
        x < 0 && !dp_min[hor.size()][-x] ||
         x == 0 && !dp_pl[hor.size()][0] && !dp_min[hor.size()][0]) {
        cout << "No" << endl;
        return 0;
    }

    for(int i = 1; i <= hor.size(); ++i) {
        for(int j = 0; j <= 8000; ++j) {
            dp_pl[i][j] = dp_min[i][j] = false;
        }
    }

    dp_pl[0][0] = dp_min[0][0] = true;
    for(int i = 0; i < ver.size(); ++i) {
        for(int j = 0; j <= 8000; ++j) {
            if(dp_pl[i][j]) {
                if(j - ver[i] < 0) {
                    dp_min[i + 1][ver[i] - j] = true;
                } else {
                    dp_pl[i + 1][j - ver[i]] = true;
                }
                dp_pl[i + 1][j + ver[i]] = true;
            }
            if(dp_min[i][j]) {
                dp_min[i + 1][j + ver[i]] = true;
                if(j - ver[i] < 0) {
                    dp_pl[i + 1][ver[i] - j] = true;
                } else {
                    dp_min[i + 1][j - ver[i]] = true;
                }
            }
        }
    }

    if(y > 0 && !dp_pl[ver.size()][y] ||
        y < 0 && !dp_min[ver.size()][-y] ||
         y == 0 && !dp_pl[ver.size()][0] && !dp_min[ver.size()][0]) {
        cout << "No" << endl;
    } else {
        cout << "Yes" << endl;
    }

    return 0;
}



Measured memory_bytes: 61952