#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <string>
#define ll long long
#define count  8000
using namespace std;
ll k[8001][2]; //k[0] 是x k[1]是y
bool a[16001];
bool b[16001];
int main(){
	string s;
	cin>>s;
	int t=0;
	int q=1;
	int w=1;
	int x,y; 
	memset(k,0,sizeof(k));
	scanf("%d%d",&x,&y);
	x+=count;
	y+=count;
	for(int i=0;i<s.size();i++){
		if(s[i]=='F') {
		   t=(t+1)%2;
		   if(k[q][t]) q++;
	       if(k[w][t])  w++;}
		if(s[i]=='T'){
			if(t) k[q][t]++;
			else  k[w][t]++;
		}
	}
	a[8000]=1;
	b[8000]=1;
	for(int i=1;i<=q;i++){
		for(int j=y+s.size();j>=8000-s.size();j--){
		     a[j]=a[j-k[i][1]]|a[j+k[i][1]];	
		}
	}
	for(int i=1;i<=w;i++){
		for(int j=x+s.size();j>=8000-s.size();j--){
			b[j]=b[j-k[i][0]]|b[j+k[i][0]];
		}
	}
	if(b[x]&&a[y]) cout<<"Yes";
	else cout<<"No";
}