#include <bits/stdc++.h>
using namespace std;
vector<int> S[2];

bool package_solve(vector<int> &S, int x) {
  vector<int> A[2];
  int cur = 1, pre = 0;
  A[pre].push_back(0);
  for (int s: S) {
    A[cur].clear();
    for (int v: A[pre]) A[cur].push_back(v + s), A[cur].push_back(v - s);
    sort(A[cur].begin(), A[cur].end());
    A[cur].erase(unique(A[cur].begin(), A[cur].end()), A[cur].end());
    swap(cur, pre);
  }
  return count(A[pre].begin(), A[pre].end(), x);
}
  
char s[10000];

int main() {
  int x, y;
  scanf("%s", s);
  int l = strlen(s);
  scanf("%d%d", &x, &y);
  
  int cur = 0, step = 0, i = 0;
  for (i = find(s, s + l,'T') - s, x -= i ; i < l; ++i) {
    if (s[i] == 'T') S[cur].push_back(step), step = 0, cur ^= 1;
    else ++step;
  }
  S[cur].push_back(step);
  puts(package_solve(S[0], x) and package_solve(S[1], y)?"Yes":"No");
  
}