#include "bits/stdc++.h"
using namespace std;
///////////////////////////////////////////
const long long int INF = 1LL<<60;
const long long int Mod = 1000000007;
using ll = long long int; using ci = const int;
using vi = vector<int>;  using Vi = vector<long long int>;
using P = pair<int, int>;  using PLL = pair<ll, ll>;
using matrix = vector<vector<ll>>;
#define pb(x) push_back(x)
#define mp(x,y) make_pair(x,y)
#define all(x) (x).begin(),(x).end()
#define rep(i,N) for(ll i = 0; i < (ll)N; i++)
#define repi(i,a,b) for(ll i = ll(a); i < ll(b); ++i)
template<class T>bool chmax(T &former, const T &b) { if (former<b) { former=b; return true; } return false; }
template<class T>bool chmin(T &former, const T &b) { if (b<former) { former=b; return true; } return false; }
template<class T>T sqar(T x){ return x*x; }//sqrt(x)は平方根;
#define Sort(v) std::sort(v.begin(), v.end(), std::greater<decltype(v[0])>()) //降順でVをソート
template<class T> inline void princ(T x){cout<<x<<" ";}; 
template<class T> inline void print(T x){cout<<x<<"\n";};
template<class T> inline void Yes(T condition){ if(condition) cout << "Yes" << endl; else cout << "No" << endl; }
template<class T> inline void YES(T condition){ if(condition) cout << "YES" << endl; else cout << "NO" << endl; }
///////////////////////////////////////////////////////////////////////////////////

string s;
ll x,y;
Vi v;
Vi vx,vy;
ll dpx[20010];
ll dpy[20010];
bool ans[20010];
bool ansy[20010];

int main(){
    cin.tie(0);ios::sync_with_stdio(false);
    std::cout<<std::fixed<<std::setprecision(30);
    cin>>s;cin>>x>>y;
    rep(i,s.size()){
        if(s[i]=='T')v.pb(-1);
        else{
            if(v.size()>0 && v[v.size()-1]!=-1)v[v.size()-1]++;
            else v.pb(1);
        }
    }
    ll tmp = 0;
    rep(i,20010){
        dpx[i]=0;
        dpy[i]=0;
        ans[i]=false;
        ansy[i] = false;
    }
    dpy[10000] = 1;
    rep(i,v.size()){
        if(i==0){
            if(v[i]==-1){tmp++; dpx[10000] = 1; }
            else dpx[v[i]+10000] = 1;
        }
        if(i != 0 && v[i]==-1){
            tmp++;
        }else if(i!=0){
            if(tmp %2 == 0)vx.pb(v[i]);
            else vy.pb(v[i]);
        }
    }
    rep(j,vx.size()){
        rep(i,20010){
            if(dpx[i]==j+1 || dpx[i] == -(j+2) || dpx[i] == -j-1){
                if(i + vx[j] < 20010){
                    if(dpx[i+vx[j]]==j+1)dpx[i+vx[j]]=-j-2;
                    else dpx[i+vx[j]] = j+2;

                    if(j==vx.size()-1)ans[i+vx[j]]=true;
                }
                if(i - vx[j] >= 0){
                    dpx[i-vx[j]] = j+2;
                    if(j==vx.size()-1)ans[i-vx[j]]=true;

                }
            }
        }
    }
    rep(j,vy.size()){
        rep(i,20010){
            if(dpy[i]==j+1 || dpy[i] == -(j+2) || dpy[i] == -j-1){
                if(i + vy[j] < 20010){
                    if(dpy[i+vy[j]]==j+1)dpy[i+vy[j]]=-j-2;
                    else dpy[i+vy[j]] = j+2;

                    if(j==vy.size()-1)ansy[i+vy[j]]=true;
                }
                if(i - vy[j] >= 0){
                    dpy[i-vy[j]] = j+2;
                    if(j==vy.size()-1)ansy[i-vy[j]]=true;

                }
            }
        }
    }
    if(vx.size()==0){
        rep(i,20010){
            if(dpx[i])ans[i] = true;
        }
    }
    if(vy.size()==0)ansy[10000] = true;
    Yes(ans[x+10000] && ansy[y+10000]);
    return 0;
}

Measured memory_bytes: 896