#include <bits/stdc++.h>
#define repz(i, z, n) for (decltype(n) i = (z); i < (n); i++)
#define rep(i, n) for (decltype(n) i = 0; i < (n); i++)

#define REPZ(i, z, n) for (decltype(n) i = (z); i <= (n); i++)
#define REP(i, n) for (decltype(n) i = 0; i <= (n); i++)
#define ALL(v) v.begin(), v.end()
#define SIZE(v) ((ll)(v).size())
#define MAX(v) (*max_element(ALL(v)))
#define MIN(v) (*min_element(ALL(v)))
#define INF 1000000000000  // 1E+12

// 略
#define PB push_back
#define F first
#define S second
#define MP make_pair
#define READ cin >>
#define PRINT cout <<
#define PYES cout << "Yes" << endl;
#define POK cout << "OK" << endl;
#define PNO cout << "No" << endl;
#define PNG cout << "NG" << endl;

using namespace std;

// デバッグ用
void debug_out() { cout << endl; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cout << H << " ";
  debug_out(T...);
}

template <class T>
bool chmax(T &a, const T &b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}
template <class T>
bool chmin(T &a, const T &b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}

#ifdef _DEBUG
#define debug(...) debug_out(__VA_ARGS__)
#else
#define debug(...)
#endif

// typedef
typedef long long ll;
typedef unsigned long long ul;
typedef long double ld;
typedef pair<ll, ll> pl;

// const
// 円周率
const ld pi = acos(-1);
// mod用
// 1E+9 +7
const ll mod = (int)1e+9 + 7;
// 1s間で可能なループ回数2E+8回
// int        最大値2147483647         〜2E+9
// long long  最大値9223372036854775807〜9E+18
// 総和accumulate
// 単純リストvector<type> push_back
// 連想配列map<key,value> insert,
// 集合set<type>
// pair キーとバリューを格納 firstとsecondでアクセス
// 小数点指定 cout << fixed << setprecision(15) << endl;
// to_string<->stoi
// stoll(longlong)
// stod(double)
// deep copy v1->v2 copy(v1.begin(), v1.end(), back_inserter(v2) );
// 大文字65-90(-32)
// 小文字97-122(+32)
//  priority_queue<pair<ll, ll>, vector<pair<ll, ll>>, greater<pair<ll, ll>>>
//  ba;
bool solve(int gx, vector<int> a, bool canmin) {
  int asize = SIZE(a);
  if (asize == 0) {
    return gx == 0;
  }
  int sum = accumulate(ALL(a), 0);
  if (sum < abs(gx)) return false;
  auto trans = [&](int x) { return x + sum; };
  auto btrans = [&](int x) { return x - sum; };
  vector<vector<bool>> dp(asize, vector<bool>(sum * 2 + 1, false));
  dp[0][trans(a[0])] = true;
  if (canmin) dp[0][trans(-a[0])] = true;
  repz(i, 1, asize) {
    rep(j, sum * 2 + 1) {
      int newxm = trans(btrans(j) - a[i]), newxp = trans(btrans(j) + a[i]);
      if (newxm >= 0 and newxm < sum * 2 + 1)
        dp[i][j] = dp[i][j] or dp[i - 1][newxm];
      if (newxp >= 0 and newxp < sum * 2 + 1)
        dp[i][j] = dp[i][j] or dp[i - 1][newxp];
    }
  }
  return dp[asize - 1][trans(gx)];
}
signed main() {
  // faster
  // C言語流の入出力は使用できない
  ios::sync_with_stdio(false);
  std::cin.tie(nullptr);
  string s;
  cin >> s;
  int gx, gy;
  cin >> gx >> gy;
  vector<int> ax, ay;
  {
    int x = 0;
    bool flag = false;
    rep(i, SIZE(s)) {
      if (s[i] == 'F') {
        x++;
      }
      if (s[i] == 'T' or (i == SIZE(s) - 1)) {
        ax.push_back(x);
        x = 0;
        swap(ax, ay);
        flag = !flag;
      }
    }
    if (flag) swap(ax, ay);
  }
  if (solve(gx, ax, false) and solve(gy, ay, true))
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
  return 0;
}


Measured memory_bytes: 2432