#include<cstdio>

char s;
int x[8003], sx, y[8003], sy, o, a, b, okx[16003], oky[16003];

inline void p() {
	s = getchar();
	while (s == 'F' || s == 'T') {
		if (s == 'F') {
			if (o) {
				y[0] ++;
			} else {
				x[0] ++;
			}
		} else {
			if (o) {
				if (y[0]) {
					y[++sy] = y[0];
					y[0] = 0;
				}
			} else {
				if (x[0]) {
					x[++sx] = x[0];
					x[0] = 0;
				}
			}
			o ^= 1;
		}
		s = getchar();
	}
	if (o) {
		if (y[0]) {
			y[++sy] = y[0];
			y[0] = 0;
		}
	} else {
		if (x[0]) {
			x[++sx] = x[0];
			x[0] = 0;
		}
	}
	scanf("%d%d", &a, &b);
	return;
}

int main() {
	p();
	okx[8000] = 1; oky[8000] = 1;
	for (int i = 1; i <= sx; ++i)
		for (int j = 1; j <= 16000; ++j) if (okx[j]) {
			okx[j + x[i]] = 1;
			okx[j - x[i]] = 1;
			okx[j] = 0;
		}
	if (!okx[a + 8000]) {
		return printf("No"), 0;
	}
	for (int i = 1; i <= sy; ++i)
		for (int j = 1; j <= 16000; ++j) if (oky[j]) {
			oky[j + y[i]] = 1;
			oky[j - y[i]] = 1;
			oky[j] = 0;
		}
	if (!oky[b + 8000]) {
		return printf("No"), 0;
	}
	printf("Yes");
	return 0;
}