#include <algorithm>
#include <cassert>
#include <cctype>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstring>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <tuple>
#include <unordered_map>
#include <vector>
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define show(x) cout << #x << " = " << x << endl;
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
void yes(){
    cout << "Yes" << endl;
}
void no(){
    cout << "No" << endl;
}
//aの要素の+-でxにできるか
bool dp[9000][9000];
bool dp2[9000][9000];
bool ok(int x, vector<int>&a){
    int n = (int)a.size();
    if(n == 0){
        if(x == 0)return true;
        else return false;
    }
    int sum = accumulate(a.begin(),a.end(),0);
    if(x > sum){
        return false;
    }
    if(x == sum){
        return true;
    }
    int k = sum-x;
    if(k%2)return false;
    else k /= 2;
    if(k > 8000)return false;
    dp[0][0] = true;
    rep(i,n){
        if(i == 0){
            dp[0][a[0]] = true;
        }
        else {
            rep(j,8005){
                if(dp[i-1][j]){
                    dp[i][j] = true;
                    dp[i][j+a[i]] = true;
                }
            }
        }
    }
    return dp[n-1][k];
}
bool ok2(int x, vector<int>&a){
    int n = (int)a.size();
    if(n == 0){
        if(x == 0)return true;
        else return false;
    }
    int sum = accumulate(a.begin(),a.end(),0);
    if(x > sum){
        return false;
    }
    if(x == sum){
        return true;
    }
    int k = sum-x;
    if(k%2)return false;
    else k /= 2;
    if(k > 8000)return false;
    dp2[0][0] = true;
    rep(i,n){
        if(i == 0){
            dp2[0][a[0]] = true;
        }
        else{
            rep(j,8005){
                if(dp2[i-1][j]){
                    dp2[i][j] = true;
                    dp2[i][j+a[i]] = true;
                }
            }
        }
    }
    return dp2[n-1][k];
}
int main(){
    string s;
    cin >> s;
    int x,y;
    cin >> x >> y;
    int f = 0;
    for(auto c:s){
        if(c == 'F'){
            f++;
        }
    }
    s += 'T';
    int n = (int)s.size();
    if(abs(x) + abs(y) > f){
        no();
        return 0;
    }
    int state = 0;//0はx,1はy
    int saisyo = 0;
    int yoko = 0;
    int tate = 0;
    vector<int>X,Y;
    rep(i,n){
        if(s[i] == 'F')saisyo++;
        else break;
    }
    x-=saisyo;
    if(abs(x) + abs(y) > f-saisyo){
        no();
        return 0;
    }
    //cout << x << " " << y << endl;
    for(int i = saisyo; i < n; i++){
        if(s[i] == 'T'){
            if(state == 0){
                if(yoko > 0){
                    X.push_back(yoko);
                    //show(yoko);
                    yoko = 0;
                }
                state = 1;
            }else{
                if(tate > 0){
                    Y.push_back(tate);
                    //show(tate);
                    tate = 0;
                }
                state = 0;
            }
        }else{
            if(state == 0){
                yoko++;
            }else{
                tate++;
            }
        }
    }
    x = abs(x);
    y = abs(y);
    if(ok(x,X) and ok2(y,Y)){
        yes();
    }else{
        no();
    }
    return 0;
}


Measured memory_bytes: 25856