/*
        _            _                  _            _       _     _         _   _          _          _             _        
       / /\         / /\               / /\         / /\    / /\  /\ \      /\_\/\_\ _     /\ \       /\ \     _    /\ \      
      / /  \       / /  \             / /  \       / / /   / / /  \ \ \    / / / / //\_\   \ \ \     /  \ \   /\_\ /  \ \     
     / / /\ \__   / / /\ \           / / /\ \__   / /_/   / / /   /\ \_\  /\ \/ \ \/ / /   /\ \_\   / /\ \ \_/ / // /\ \_\    
    / / /\ \___\ / / /\ \ \         / / /\ \___\ / /\ \__/ / /   / /\/_/ /  \____\__/ /   / /\/_/  / / /\ \___/ // / /\/_/    
    \ \ \ \/___// / /  \ \ \        \ \ \ \/___// /\ \___\/ /   / / /   / /\/________/   / / /    / / /  \/____// / / ______  
     \ \ \     / / /___/ /\ \        \ \ \     / / /\/___/ /   / / /   / / /\/_// / /   / / /    / / /    / / // / / /\_____\ 
 _    \ \ \   / / /_____/ /\ \   _    \ \ \   / / /   / / /   / / /   / / /    / / /   / / /    / / /    / / // / /  \/____ / 
/_/\__/ / /  / /_________/\ \ \ /_/\__/ / /  / / /   / / /___/ / /__ / / /    / / /___/ / /__  / / /    / / // / /_____/ / /  
\ \/___/ /  / / /_       __\ \_\\ \/___/ /  / / /   / / //\__\/_/___\\/_/    / / //\__\/_/___\/ / /    / / // / /______\/ /   
 \_____\/   \_\___\     /____/_/ \_____\/   \/_/    \/_/ \/_________/        \/_/ \/_________/\/_/     \/_/ \/___________/    
                                                                                                                              
*/
#include<bits/stdc++.h>
using namespace std;
#define ALL(obj) (obj).begin(), (obj).end()
#define REP(i, n) for(int i = 0;i < (n);++i)

#define endl '\n'
#define pb emplace_back
#define mkp make_pair
#define p_q priority_queue
#define INF 2000000000
#define PI 3.1415926
#define coutdb cout << fixed << setprecision(10)

const int dx[]={1,0,-1,0}, dy[]={0,-1,0,1};
const int dx_8[]={1,1,0,-1,-1,-1,0,1}, dy_8[]={0,-1,-1,-1,0,1,1,1};
const long long MOD = 1e9+7;

typedef long long ll;
// #define int long long

template <typename T> inline T GCD(T a,T b){T c;while(b!=0){c=a%b;a=b;b=c;}return a;}
template <typename T> inline T LCM(T a,T b){T c=GCD(a,b);a/=c;return a*b;}
template <typename T> inline T nCr(T a,T b){T i,r=1;for(i=1;i<=b;i++){r*=(a+1-i);r/=i;}return r;}
template <typename T> inline T nHr(T a,T b){return nCr(a+b-1,b);}

string s; int x, y;
bool dpx[8010][16005], dpy[8010][16005];

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

  cin >> s >> x >> y; x += 8000; y += 8000;
  int combo = 0;
  vector<int> vec;
  REP(i, s.size()){
    if(s[i] == 'F') combo++;
    else {
      vec.pb(combo);
      combo = 0;
    }
  }
  if(combo) vec.pb(combo);

  dpx[0][8000] = dpx[1][8000+vec[0]] = 1;
  dpy[0][8000] = 1;
  for(int i = 1; i < vec.size(); i++){
    for(int j = 8000-s.size(); j <= 8000+s.size(); j++){
      if(i % 2 == 0){ // x
        if(j-vec[i]>=0 and j+vec[i]<=16000) dpx[i+1][j] = dpx[i-1][j-vec[i]] or dpx[i-1][j+vec[i]];
        else if(j-vec[i]>=0) dpx[i+1][j] = dpx[i-1][j-vec[i]];
        else if(j+vec[i]<=16000) dpx[i+1][j] = dpx[i-1][j+vec[i]];
      } else { // y
        if(i == 1){
          dpy[i+1][8000-vec[i]] = dpy[i+1][8000+vec[i]] = 1;
          continue;
        }
        if(j-vec[i]>=0 and j+vec[i]<=16000) dpy[i+1][j] = dpy[i-1][j-vec[i]] or dpy[i-1][j+vec[i]];
        else if(j-vec[i]>=0) dpy[i+1][j] = dpy[i-1][j-vec[i]];
        else if(j+vec[i]<=16000) dpy[i+1][j] = dpy[i-1][j+vec[i]];
      }
    }
  }
  if(dpx[((vec.size()%2) ? vec.size() : vec.size()-1)][x] and dpy[vec.size()/2*2][y]){
    cout << "Yes" << endl;
  } else cout << "No" << endl;

  return 0;
}

Measured memory_bytes: 249344