#include <iostream>
#include <vector>
#include <string>

using namespace std;

bool check(int target, const vector<int> v){
	int dp[2][20000];
	fill(dp[0], dp[0]+20000, 0);
	dp[0][10000] = 1;
	for(int i=0;i<v.size();i++){
		int cur = i%2, next = 1-cur;
		fill(dp[next], dp[next]+20000, 0);
		for(int j=0;j<20000;j++){
			if(!dp[cur][j]) continue;
			dp[next][j-v[i]] = 1;
			dp[next][j+v[i]] = 1;
		}
	}
	return dp[v.size()%2][10000 + target];
}

int main(){
	string S;
	while(cin >> S){
		int x, y; cin >> x >> y;
		int idx = 0, turn = 0, first = 1;
		vector<int> seg[2];
		while(idx < S.size()){
			int p = 0;
			while(idx < S.size() && S[idx] == 'F'){ ++p; ++idx; }
			if(first){
				x -= p;
				first = 0;
			} else {
				seg[turn].push_back(p);
			}
			++idx;
			turn = 1 - turn;
		}
		cout << ((check(x, seg[0]) && check(y, seg[1])) ? "Yes" : "No") << endl;
	}
}
