#include <bits/stdc++.h>
using namespace std;
typedef long long lint;
#define rep(i,n) for(lint (i)=0;(i)<(n);(i)++)
#define repp(i,m,n) for(lint (i)=(m);(i)<(n);(i)++)
#define repm(i,n) for(lint (i)=(n-1);(i)>=0;(i)--)
#define INF (1ll<<60)
#define all(x) (x).begin(),(x).end()
const lint MOD =1000000007;
const lint MAX = 1000000;
using Graph =vector<vector<lint>>;
typedef pair<lint,lint> P;
 
 
lint fac[MAX], finv[MAX], inv[MAX];
 
void COMinit() 
{
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (lint i = 2; i < MAX; i++)
    {
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}
 
long long COM(lint n, lint k)
{
    if (n < k)
        return 0;
    if (n < 0 || k < 0)
        return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
 
lint primary(lint num)
{
    if (num < 2) return 0;
    else if (num == 2) return 1;
    else if (num % 2 == 0) return 0;
 
    double sqrtNum = sqrt(num);
    for (int i = 3; i <= sqrtNum; i += 2)
    {
        if (num % i == 0)
        {
            return 0;
        }
    }
 
    return 1;
}
   long long modpow(long long a, long long n, long long mod) {
    long long res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}
    lint lcm(lint a,lint b){
        return a/__gcd(a,b)*b;
    }
     lint gcd(lint a,lint b){
        return __gcd(a,b);
    } 
    bool dpx[8005][8005];
    bool dpy[8005][8005];
  int main(){      
    string s;
    cin>>s;
    lint x,y;
    cin>>x>>y;
    lint a=0;
    vector<lint> xx;
    vector<lint> yy;
    lint count=0;
    rep(i,s.size()){
        if(s[i]=='T'){
            if(a==0){
                x-=count;
                count=0;
                a++;
                continue;
            }
            if(count!=0){
            if(a%2==0)xx.push_back(count);
            else yy.push_back(count);
            count=0;
            }
            a++;
        }else count++;
    }
     
    if(count!=0){
         if(a==0){
                x-=count;
               
            }
           else if(a%2==0)xx.push_back(count);
            else yy.push_back(count);
            count=0;
            }
             x=abs(x);
            y=abs(y);
        lint sumx=0;
        lint sumy=0;
        rep(i,xx.size())sumx+=xx[i];
        rep(i,yy.size())sumy+=yy[i];
        if(sumx-x<0||sumy-y<0||(sumx-x)%2==1||(sumy-y)%2==1){
            cout<<"No"<<endl;
            return 0;
        }
        x=(sumx-x)/2;
        y=(sumy-y)/2;
        memset(dpx,0,sizeof(dpx));
        memset(dpy,0,sizeof(dpy));
        dpx[0][0]=1;
        dpy[0][0]=1;
         rep(i,xx.size()){
             rep(j,x+1){
                 dpx[i+1][j]|=dpx[i][j];
                if (j >= xx[i]) dpx[i+1][j] |= dpx[i][j-xx[i]];
             }
         }
           rep(i,yy.size()){
             rep(j,y+1){
                 dpy[i+1][j]|=dpy[i][j];
                if (j >= yy[i]) dpy[i+1][j] |= dpy[i][j-yy[i]];
             }
         }
       
         if(dpx[xx.size()][x]&&dpy[yy.size()][y])cout<<"Yes"<<endl;
         else cout<<"No"<<endl;
  }
          
  

Measured memory_bytes: 127232