#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <cstdio>
#include <cmath>
#include <tuple>
#include <iomanip>
#include <numeric>
#include <unordered_map>
#include <sstream>   
#include<limits.h>
#include<float.h>
#include<list>
#include <array>
#include <complex>
#include<stdio.h>
#include<string.h>
#include <bitset>

using namespace std;
#define int  long long

#define I32_MAX 2147483647
#define I64_MAX 9223372036854775807LL
#define I64_MAX2 1223372036854775807LL
#define INF I64_MAX2
#define MOD 1000000007
#define MEM_SIZE 10000
#define DEBUG_OUT true
#define ALL(x) (x).begin(),(x).end()


template<typename T> void DEBUG(T e){if(DEBUG_OUT == false)return; std::cout << e <<" ";}
template<typename T> void DEBUG(const std::vector<T>& v){if(DEBUG_OUT == false)return;for(const auto& e : v){std::cout<< e << " "; } std::cout << std::endl;}
template<typename T> void DEBUG(const std::vector<std::vector<T> >& vv){if(DEBUG_OUT == false)return;for(const auto& v : vv){ DEBUG(v); } }
template<class T,class... Ts> void DEBUG(T d, Ts... e){if(DEBUG_OUT == false)return;DEBUG(d);DEBUG(e...);}
template <class T> void corner(bool flg, T hoge) {if (flg) {cout << hoge << endl; exit(0);}}
template< typename T1, typename T2 > inline bool chmax(T1 &a, T2 b) { return a < b && (a = b, true); }
template< typename T1, typename T2 > inline bool chmin(T1 &a, T2 b) { return a > b && (a = b, true); }


void solve(void)
{
  string str;
  cin>>str;
  int Tx ,Ty;
  cin>>Tx>>Ty;
  vector<int> Vx,Vy;
  int init = 0;
  while(str[init] != 'T')
  {
    init++;
    if(init == str.size())break;
  }
  Tx -= init;
  Tx = abs(Tx);
  Ty = abs(Ty);
  // DEBUG(init);
  Vx.push_back(0);
  Vy.push_back(0);
  for (int i = init; i < str.size(); i++)
  {
    static int cnt = 0;
    static int MODE = 0;
    if(str[i] == 'F')cnt++;
    else
    {
      if(MODE == 0)
      Vx.push_back(cnt);
      else Vy.push_back(cnt);
      MODE ^=1;
      cnt = 0;
    }
    if(i == str.size() -1 && str[i] =='F')
    {
      if(MODE == 0)
      Vx.push_back(cnt);
      else Vy.push_back(cnt);
    }
  }
  int N = str.size();
  vector<vector<int> > DPx (Vx.size()+1,vector<int>(2*N+3,0));
  DPx[0][N] = 1;
  for (int i = 1; i < Vx.size() + 1; i++)
  {
    for (int j = 0; j < 2*N+1; j++)
    {
      int nj1 = j + Vx[i-1];
      int nj2 = j - Vx[i-1];
      if(nj1 >= 0 && nj1 <= 2*N)
      {
        DPx[i][nj1] |= DPx[i-1][j];
      } 
      if(nj2 >= 0 && nj2 <= 2*N)
      {
        DPx[i][nj2] |= DPx[i-1][j];
      } 
    }
  }
  int check = 0;
  if(DPx[Vx.size()][Tx + N] == 1 )check = 1;
  vector<vector<int> >().swap(DPx);
  vector<vector<int> > DPy (Vy.size()+1,vector<int>(2*N+3,0));
  DPy[0][N] = 1;
  for (int i = 1; i < Vy.size() + 1; i++)
  {
    for (int j = 0; j < 2*N+1; j++)
    {
      int nj1 = j + Vy[i-1];
      int nj2 = j - Vy[i-1];
      if(nj1 >= 0 && nj1 <= 2*N)
      {
        DPy[i][nj1] |= DPy[i-1][j];
      } 
      if(nj2 >= 0 && nj2 <= 2*N)
      {
        DPy[i][nj2] |= DPy[i-1][j];
      } 
    }
  }
  // DEBUG(Vx);
  // DEBUG(DPx);
  if(check&&DPy[Vy.size()][Ty + N] == 1)
  {
    cout<<"Yes"<<endl;
  }
  else
  {
    cout<<"No"<<endl;
  }
  
  
  
  

  
  return;
}
int32_t main(int32_t argc, const char *argv[])
{
std::ios::sync_with_stdio(false);
std::cin.tie(0);

std::cout << std::fixed;
std::cout << std::setprecision(9);
solve();

return 0;
}


Measured memory_bytes: 492716