#include <cstdio>
#include <string>
#include <algorithm>
#include <vector>
#include <numeric>
 
bool ok(const std::vector<int> &a, int k) {
  std::vector<int> dp(k+1, -1);
  dp[0] = 0;
  for (size_t i=0; i<a.size(); ++i) {
    for (int j=0; j<=k; ++j) {
      if (dp[j] >= 0) {
        dp[j] = 1;
      } else if (j < a[i] || dp[j-a[i]] <= 0) {
        dp[j] = -1;
      } else {
        dp[j] = dp[j-a[i]] - 1;
      }
    }
  }
  return dp[k] >= 0;
}
 
int main() {
  char buf[8192];
  scanf("%s", buf);
  std::string s=buf;
 
  int x, y;
  scanf("%d %d", &x, &y);
 
  std::vector<int> d[2];
  int k=0, cur=0;
  for (size_t i=0; i<s.length(); ++i) {
    if (s[i] == 'F') {
      ++cur;
    } else {
      d[k].push_back(cur);
      cur = 0;
      k ^= 1;
    }
  }
  d[k].push_back(cur);
 
  x -= d[0].front();
  d[0].erase(d[0].begin());
  x = std::abs(x);
  y = std::abs(y);
 
  std::sort(d[0].begin(), d[0].end());
  std::sort(d[1].begin(), d[1].end());
 
  int xs=std::accumulate(d[0].begin(), d[0].end(), 0);
  int ys=std::accumulate(d[1].begin(), d[1].end(), 0);
  if (xs < x || ys < y)
    return !printf("No\n");
 
  if (xs == x && ys == y)
    return !printf("Yes\n");
 
  if ((xs-x)%2 || (ys-y)%2)
    return !printf("No\n");
 
  if (ok(d[0], (xs-x)/2) && ok(d[1], (ys-y)/2)) {
    printf("Yes\n");
  } else {
    printf("No\n");
  }
}