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

using namespace std;

bool can_make_sum(const vector<int> &a, int init, int sum)
{
	set<int> s;
	s.insert(init);
	for (int x : a) {
		set<int> t;
		for (auto y : s) {
			t.insert(y + x);
			t.insert(y - x);
		}
		s.swap(t);
	}
	return s.count(sum) != 0;
}

int main()
{
	string s;
	int x, y;
	cin >> s >> x >> y;
	s += 'T';

	bool first = true;
	bool dirx = true;
	int d = 0;
	int init_x = 0;
	vector<int> xs;
	vector<int> ys;
	for (auto c : s) {
		if (c == 'F') {
			++d;
		}
		else {
			if (first) {
				init_x = d;
				first = false;
			}
			else if (dirx) {
				xs.push_back(d);
			}
			else {
				ys.push_back(d);
			}
			dirx = !dirx;
			d = 0;
		}
	}

	if (can_make_sum(xs, init_x, x) && can_make_sum(ys, 0, y)) {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}
}
