#include<iostream>
#include<string.h>
#include<queue>
#include<vector>
#include <cstdlib>
#include<algorithm>
#include <cstdio>
#include <cctype>
using namespace std;
const long long INF=1000000000LL;
typedef long long ll;
typedef pair<int,int> Q;
typedef pair<int,Q> Pa;
ll N,A[100005],D[2][8005]={},B[200005]={};
ll L[55],ans=0;
int xy[2];
int kx[4]={1,0,-1,0},ky[4]={0,-1,0,1};
int h=0;
int hk[2];
string s;
bool dp[2][8000][16000]={};
bool reg(int n,int k,ll v){
	if(dp[n][k][v])return false;
	if(k==hk[n]){
		if(v==xy[n])return true;
		return false;
	}
	if(reg(n,k+1,v+D[n][k])||reg(n,k+1,v-D[n][k]))return true;
	dp[n][k][v]=true;
	return false;
}

int main(){
	cin>>s>>xy[0]>>xy[1];
	for(int i=0;i<s.size();++i){
		if(s[i]=='T')h++;
		else D[h%2][h/2]++;
	}
	h++;
	hk[0]=h/2+h%2;
	hk[1]=h/2;
	if(reg(0,1,D[0][0])&&reg(1,0,0)){
		cout<<"Yes"<<endl;
	}else{
		cout<<"No"<<endl;
	}
	return 0;
}
