#include<bits/stdc++.h>
using namespace std;
using ll = long long;
int main(){
	string s; cin >> s;
	ll x, y; cin >> x >> y;
	queue<ll> q[2];
	bool mode = 1;
	ll sf = 0;
	s += 'T';
	while(s[sf] != 'T'){
		--x;
		++sf;
	}
	ll po = 0;
	for(ll i = sf + 1; i < s.size(); ++i){
		if(s[i] == 'T'){
			q[(int)mode].push(po);
			mode = !mode;
			po = 0;
		}else{
			++po;
		}
	}
	for(ll count = 0; count <= 1; ++count){
		ll dpsub[16000 + 1] = {};
		ll *dp = dpsub + 8000;
		dp[0] = 1;
		while(q[count].size()){
			ll yo = q[count].front();
			q[count].pop();
			ll dpsubnext[16000 + 1] = {};
			ll *dpnext = dpsubnext + 8000;
			for(ll i = -8000; i <= 8000; ++i){
				if(dp[i]){
					dpnext[i - yo] = dpnext[i + yo] = 1;
				}
			}
			for(ll i = -8000; i <= 8000; ++i) dp[i] = dpnext[i];
		}
		if(!dp[(count ? y : x)]){
			cout << "No\n";
			return 0;
		}
	}
	cout << "Yes\n";
	return 0;
}