// #define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define rep(i, n) for (int i = 0; i < n; ++i)
#define REP(i, n) for (int i = 0; i < n; ++i)
#define range(i,a,b) ((int)(a)<=(int)(i) && (int)(i)<(int)(b))
#define debug(x) cout << #x << ' ' << '=' << ' ' << (x) << endl;
#define fs first
#define sc second
#define pb push_back
#define eb emplace_back
typedef long long ll;
typedef pair<ll, ll> P;
typedef tuple<ll, ll, ll> T;
typedef vector<ll> vec;
typedef vector<P> pvec;
typedef vector<vector<ll>> vvec;
typedef vector<vector<P>> pvvec;
typedef priority_queue<ll> PQI;
typedef priority_queue<P> PQP;
typedef priority_queue<ll,vector<ll>,greater<ll>> PQIG;
typedef priority_queue<P,vector<P>,greater<P>> PQPG;
const vector<int> dx = {0, -1, 0, 1, 1, 1, -1, -1};
const vector<int> dy = {1, 0, -1, 0, 1, -1, 1, -1};
const int MOD = (1000000007);
// const int MOD = (998244353);
// const int INF = (1 << 30);
const int INF = (1LL << 60);
const double EPS = (1 >> 30);
template<class T> inline bool chmin(T& a, T b) {if (a > b) {a = b; return 1;} return 0;}
template<class T> inline bool chmax(T& a, T b) {if (a < b) {a = b; return 1;} return 0;}
template< typename T1, typename T2 > istream &operator>>(istream &is, pair< T1, T2 > &p) { is >> p.first >> p.second; return is; }
template< typename T > istream &operator>>(istream &is, vector< T > &v) { for(T &in : v) is >> in; return is; }



signed main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << fixed << setprecision(15);
    //---------------------------------------------

    // REがわからない、お手上げ
    
    string s;int x,y;
    cin>>s>>x>>y;
    s+="TT";
    int tcnt=0;
    int dist=0;
    int geta=8000;
    vec xx(0),yy(0); // x方向とy方向の移動で分ける
    int n=s.size();
    rep(i,n){
        if(s[i]=='T'){
            if(tcnt%2==0) xx.pb(dist);
            if(tcnt%2==1) yy.pb(dist);
            dist=0;
            tcnt++;
            continue;
        }
        dist++;
    }

    // for(auto xxx:xx) debug(xxx);
    // for(auto yyy:yy) debug(yyy);

    // int xdp[xx.size()+10][2*geta+10];
    vvec xdp((max(xx.size(),yy.size())+10),vec (2*geta+10));
    // int ydp[yy.size()+10][2*geta+10];
    // vvec ydp((yy.size()+10),vec (2*geta+10));
    // rep(i,xx.size()+10) rep(j,2*geta+10) xdp[i][j]=0;
    // rep(i,yy.size()+10) rep(j,2*geta+10) ydp[i][j]=0;

    // x方向のdp
    xdp[0][xx[0]+geta]=1;
    for(int i=1;i<xx.size();i++){
        int dist=xx[i];
        rep(j,2*geta+10){
            if(xdp[i-1][j]==1){
                if(range(j+dist,0,2*geta+10)) xdp[i][j+dist]=1;
                if(range(j-dist,0,2*geta+10)) xdp[i][j-dist]=1;
            }
        }
    }
    int xmemo=xdp[xx.size()-1][x+geta];
  
  	rep(i,max(xx.size(),yy.size())+10){
        rep(j,2*geta+10){
            xdp[i][j]=0;
        }
    }

    // y方向のdp
    xdp[0][geta+yy[0]]=1;
    xdp[0][geta-yy[0]]=1;
    for(int i=1;i<yy.size();i++){
        int dist=yy[i];
        rep(j,2*geta+10){
            if(xdp[i-1][j]==1){
                if(range(j+dist,0,2*geta+10)) xdp[i][j+dist]=1;
                if(range(j-dist,0,2*geta+10)) xdp[i][j-dist]=1;
            }
        }
    }

    if(xmemo==1&&xdp[yy.size()-1][y+geta]==1){
        cout<<"Yes"<<endl;
    }
    else{
        cout<<"No"<<endl;
    }

    return 0;
}


Measured memory_bytes: 498176