/*
	Author: houtaru
	Create: 17.12.2017 22:12:26
*/
#include <bits/stdc++.h>
using namespace std;

const int maxn = 8888;

int n;
char s[maxn];
bitset <maxn << 2> x, y;

int main() {
	scanf("%s", s);
	n = strlen(s); s[++n] = 'T';
	bool side = 0, first = 1;
	x[maxn] = 1; y[maxn] = 1;
	for (int i = 0, len = 0; i <= n; ++i) {
		if (s[i] == 'F') len++;
		else {
			auto &axis = (side) ? y : x;
			if (first) axis <<= len;
			else axis = (axis << len) | (axis >> len);
			len = 0; side ^= 1; first = 0;
		}
	}
	int xs, ys; scanf("%d%d", &xs, &ys);
	bool ok = x[xs + maxn] && y[ys + maxn];
	puts(ok ? "Yes" : "No");

	return 0;
}