//ΔARC087D
#include<iostream>
#include<cstdio>
#include<fstream>
#include<algorithm>
#include<vector>
#include<map>
#include<set>
#include<queue>
#include<cmath>
#include<cstring>
#include<cstdlib>
using namespace std;
typedef long long LL;
const int N = 8080;
char ch[N];
int n,x,y;
vector<int> v[2];
int dp[N][N<<1];
int main()
{
	int i,j,k,h,ans;
	scanf("%s%d%d",ch,&x,&y);
	n=strlen(ch);
	i=0;
	while(ch[i]=='F'){
		x--;
		i++;
	}
	if(x<-N+5){
		cout<<"No\n";
		return 0;
	}
	j=0;
	k=0;
	for(;i<=n;i=i+1){
		if(i!=n&&ch[i]=='F')
			k++;
		else{
			if(k)
				v[j].push_back(k);
			j^=1;
			k=0;
		}
	}
	ans=1;
	memset(dp,0,sizeof(dp));
	dp[0][N]=1;
	h=v[0].size();
	for(i=0;i<h;i=i+1){
		k=v[0][i];
		for(j=5;j<N+N-5;j=j+1)
			if(dp[i][j])
				dp[i+1][j+k]=1,dp[i+1][j-k]=1;
	}
	ans&=dp[h][x+N];
	memset(dp,0,sizeof(dp));
	dp[0][N]=1;
	h=v[1].size();
	for(i=0;i<h;i=i+1){
		k=v[1][i];
		for(j=5;j<N+N-5;j=j+1)
			if(dp[i][j])
				dp[i+1][j+k]=1,dp[i+1][j-k]=1;
	}
	ans&=dp[h][y+N];
	if(ans)
		cout<<"Yes\n";
	else
		cout<<"No\n";
	return 0;
}