// Original C++ solution (slower):
#include<iostream>

#include<vector>

#include<string>

#include<cmath>

#include<algorithm>



using namespace std;



#define FOR(i,r,n) for(ll i = (ll)(r); i < (ll)(n); i++)

#define RFOR(i,r,n) for(ll i=(ll)(n-1);i>=r;i--)

#define ALL(x) x.begin(),x.end()

#define RALL(x) x.rbegin(),x.rend()

typedef long long int ll;

typedef vector<ll> vll;

typedef vector<string> vs;

typedef vector<char> vc;

typedef vector<bool> vb;



ll a = 0, n = 0, m = 0, k = 0, ans = 0, sum = 0, cnt = 0;

string s;

char c;

bool flag;



//----------------------------------------------------------------------







int main(void) {

  ll x, y;

  vll xll, yll;

  vb x1(40100, false), x2(40100, false), y1(40100, false), y2(40100, false);

  bool flag2 = true;



  cin >> s;

  cin >> x >> y;



  for (ll i = 0;s[i] != 'T' && i < s.size();i++) {

	cnt++;

  }



  x -= cnt;

  flag = true;

  x1[20000] = true;

  y1[20000] = true;



  FOR(i, cnt, s.size()) {

	if (s[i] == 'T' && flag == true) {

	  yll.push_back(0);

	  flag = false;

	}

	else if (s[i] == 'T' && flag == false) {

	  xll.push_back(0);

	  flag = true;

	}

	else if (s[i] == 'F' && flag == true) {

	  xll[xll.size() - 1]++;

	}

	else if (s[i] == 'F' && flag == false) {

	  yll[yll.size() - 1]++;

	}

  }



  flag = true;



  FOR(i, 0, xll.size()) {

	if (flag == true) {

	  FOR(j, 0, 40100) {

		if (x1[j] == true) {

		  x2[j + xll[i]] = true;

		  x2[j - xll[i]] = true;

		}

	  }

	  FOR(j, 0, 40100) {

		x1[j] = false;

	  }

	  flag = false;

	  continue;

	}



	if (flag == false) {

	  FOR(j, 0, 40100) {

		if (x2[j] == true) {

		  x1[j + xll[i]] = true;

		  x1[j - xll[i]] = true;

		}

	  }

	  FOR(j, 0, 40100) {

		x2[j] = false;

	  }

	  flag = true;

	  continue;

	}

  }



  FOR(i, 0, yll.size()) {

	if (flag2 == true) {

	  FOR(j, 0, 40100) {

		if (y1[j] == true) {

		  y2[j + yll[i]] = true;

		  y2[j - yll[i]] = true;

		}

	  }

	  FOR(j, 0, 40100) {

		y1[j] = false;

	  }

	  flag2 = false;

	  continue;

	}



	if (flag2 == false) {

	  FOR(j, 0, 40100) {

		if (y2[j] == true) {

		  y1[j + yll[i]] = true;

		  y1[j - yll[i]] = true;

		}

	  }

	  FOR(j, 0, 40100) {

		y2[j] = false;

	  }

	  flag2 = true;

	  continue;

	}

  }



  if (flag == true) {

	if (x1[20000 + x]) {

	}

	else {

	  cout << "No" << endl;

	  return 0;

	}

  }

  else {

	if (x2[20000 + x]) {

	}

	else {

	  cout << "No" << endl;

	  return 0;

	}

  }



  if (flag2 == true) {

	if (y1[20000 + y]) {

	  cout << "Yes" << endl;

	  return 0;

	}

	else {

	  cout << "No" << endl;

	  return 0;

	}

  }

  else {

	if (y2[20000 + y]) {

	  cout << "Yes" << endl;

	  return 0;

	}

	else {

	  cout << "No" << endl;

	  return 0;

	}

  }



  return 0;

}


// Optimized solution to the same problem (faster):
#include<iostream>

#include<vector>

#include<queue>

#include<stack>

#include<list>

#include<string>

#include<cmath>

#include<algorithm>

#include<bitset>

#include<map>

#include<functional>

#include<set>



using namespace std;



#define FOR(i,r,n) for(ll i = (ll)(r); i < (ll)(n); i++)

#define RFOR(i,r,n) for(ll i=(ll)(n-1);i>=r;i--)

#define ALL(x) x.begin(),x.end()

#define RALL(x) x.rbegin(),x.rend()

#define INF 9223372036854775807

#define MOD 1000000007

typedef long long int ll;

typedef long double ld;

typedef vector<ll> vll;

typedef vector<string> vs;

typedef pair<ll, ll> pll;



ll n = 0, m = 0, ans = 0, sum = 0, cnt = 0, temp = 0;

string s;

bool flag;



//-------------------------------------------------------------------------------



#define MAX 10000



set<ll> dp1, dp2;



void dp(ll value, set<ll> &sta, set<ll> &stb) {

  for (auto it : sta) {

	stb.insert(it + value);

	stb.insert(it - value);

  }

}



int main(void) {

  ll x, y, ans1, ans2;

  vll vx, vy;

  cin >> s;

  cin >> x >> y;



  while (temp < s.size()) {

	if (s[temp] == 'T') break;

	temp++;

  }

  dp1.insert(temp);



  flag = false;

  FOR(i, temp+1, s.length()) {

	if (s[i] == 'F') {

	  cnt++;

	}

	else {

	  if (cnt == 0) {

		flag = !flag;

		continue;

	  }

	  flag ? vx.push_back(cnt) : vy.push_back(cnt);

	  flag = !flag;

	  cnt = 0;

	}

  }

  flag ? vx.push_back(cnt) : vy.push_back(cnt);



  flag = true;

  FOR(i, 0, vx.size()) {

	flag ? dp2.clear() : dp1.clear();

	flag ? dp(vx[i], dp1, dp2) : dp(vx[i], dp2, dp1);

	flag = !flag;

  }

  if (flag) {

	ans1 = dp1.count(x);

  }

  else {

	ans1 = dp2.count(x);

  }



  dp1.clear();

  dp2.clear();

  dp1.insert(0);



  flag = true;

  FOR(i, 0, vy.size()) {

	flag ? dp2.clear() : dp1.clear();

	flag ? dp(vy[i], dp1, dp2) : dp(vy[i], dp2, dp1);

	flag = !flag;

  }

  if (flag) {

	ans2 = dp1.count(y);

  }

  else {

	ans2 = dp2.count(y);

  }



  if (ans1 > 0 && ans2 > 0) {

	cout << "Yes" << endl;

  }

  else {

	cout << "No" << endl;

  }



  return 0;

}

// Fastest known solution for this problem: