#include <set>
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cstring>
#include <unordered_map>
#include <sstream>
using namespace std;
std::string to_binString2(unsigned int val, int n)
{
    std::string str;
    while( val != 0 ) {
        if( (val & 1) == 0 )  
            str.insert(str.begin(), '0');
        else
            str.insert(str.begin(), '1');
        val >>= 1;
    };
    while (str.size() != n) {
      str.insert(str.begin(), '0');
    }
    return str;
}
std::string to_binString(unsigned int val)
{
    if( !val )
        return std::string("0");
    std::string str;
    while( val != 0 ) {
        if( (val & 1) == 0 ) 
            str.insert(str.begin(), '0');  
        else
            str.insert(str.begin(), '1');  
        val >>= 1;
    }
    return str;
}
vector<int> split(const string &str, char sep)
{
  vector <int>v;
  stringstream ss(str);
  string buf;
  while (getline(ss, buf, sep) ) {
   v.push_back(buf.size());
  }


  int k = 0;
  return v;

}



int main()
{
  string str;
  vector<int> v;
  int x, y;
  cin >> str;
  cin >> x;
  cin >> y;
  string buf;
  v = split(str, 'T');
  unordered_map<string,vector<int>> mp;
  vector<int> east;
  vector<int> north;
  unordered_map<int,int> east1, north1;



  int k = 0;
  for (int i : v) {
    if ((k%2)==0) {
      if (i != 0) {
        if (k == 0) {
          x -= i;
        } else {
          east.push_back(i);
        }
      }
    } else {
      if (i != 0)
        north.push_back(i);
    }
    k += 1;
  }


  //----------------------------------------
  set<int>myset_north={0}, myset_east={0};

  //east pattern -------------------------------------------------------
  for (auto i : east) {
    //cout << "east: " << i << endl;
    set<int>a;
    for (auto x : myset_east) {
      a.insert(x+i);
      a.insert(x-i);
  //    cout << "east:x+i:" << x+i << endl;
  //    cout << "east:x-i:" << x-i << endl;
    } 
    if (a.empty()){
  //    cout << "east:x+i:" << i << endl;
  //    cout << "east:x-i:" << -i << endl;
      a.insert(i);
      a.insert(-i);
    }
    myset_east=a;
  }
  //for (auto i : myset_east) {
  //  cout << "myset_eastaa :  " << i << endl;
  //}
  //north pattern -------------------------------------------------------
  for (auto i : north) {
    //cout << "north: " << i << endl;
    set<int>a;
    for (auto x : myset_north) {
      a.insert(x+i);
      a.insert(x-i);
      //cout << "north:x+i:" << x+i << endl;
      //cout << "north:x-i:" << x-i << endl;
    }
    if (a.empty()){
      //cout << "north:x+i:" << i << endl;
      //cout << "north:x-i:" << -i << endl;
      a.insert(i);
      a.insert(-i);
    }
    myset_north=a;
  }
  //for (auto i : myset_north) {
  //  cout << "myset_northaa :  " << i << endl;
  //}

//  for (auto i: myset_east) 
//    cout << "east: " << i << endl;
//  for (auto i: myset_north) 
//    cout << "north: " << i << endl;

 // cout << "x: " << x << endl;
 // cout << "y: " << y << endl;

  for (auto i : myset_north) {
    //cout << "myset_north: element: " << i << endl;
    //cout << "i : " << i << ", ";
    //cout << "x : " << x << ", ";
    //cout << "x==i : " << to_string(x==i) << endl;
    if (i == y) {
      //cout << "inside!" << endl;
      for (auto p : myset_east) {
        //cout << "myset_east: element: " << p << endl;
        if (p == x) {
          cout << "Yes" << endl;
          return 0;
        }
      }
    }
  }
  cout << "No" << endl;


}


Measured memory_bytes: 768