// Slower C++ solution:
#include <bits/stdc++.h>

using ll = long long;

using namespace std;

#define rep(i,n) for(int i=0, i##_len=(int)(n); i<i##_len; i++)

#define reps(i,n) for(int i=1 , i##_len=(int)(n);i<=i##_len;i++)

#define rrep(i,n) for(int i=((int)(n)-1);i>=0;i--)

#define rreps(i,n) for(int i=((int)(n));i>0;i--)

#define repi(i,x) for(auto i=(x).begin(),i##_fin=(x).end();i!=i##_fin;i++)

#define all(x) (x).begin(), (x).end()

#define F first

#define S second

#define mp make_pair

#define pb push_back

#define solve(a) ((a)?"Yes":"No")

typedef vector<int> Vi;

typedef vector<Vi> VVi;

typedef pair<int , int> Pi;

typedef vector<Pi> VPi;

typedef vector<long long> V;

typedef vector<V> VV;

typedef pair<long long , long long> P;

typedef vector<P> VP;

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1;} return 0;}

template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1;} return 0;}

const long long INFLL = 1LL<<60;

const int INF = 1<<30;

const double PI=acos(-1);

int main(){

	string s;

	bool ans=true;

	cin >>s;

	int x,y;

	cin>>x>>y;

	x+=10000;

	y+=10000;

	vector<int>X,Y;

	bool turn =false;

	int cnt=0;

	rep(i,s.size()){

		if(s[i]=='T'){

			if(cnt!=0){

				if(turn){

					Y.push_back(cnt);

				}else{

					X.push_back(cnt);

				}

				cnt=0;

			}

			if(turn){

				turn=false;

			}else{

				turn=true;

			}

		}else

		{

			cnt++;

		}

		

	}

	if (cnt != 0)

	{

		if (turn)

		{

			Y.push_back(cnt);

		}

		else

		{

			X.push_back(cnt);

		}

		cnt = 0;

	}

	if(s[0]=='F' and X.size()!=0){

		x-=X.front();

		X.erase(X.begin());

	}

	//X.push_back(0);

	//Y.push_back(0);

	vector<int>dp(20000,-1);//st:10000

	vector<int> bef(20000, -1); //st:10000

	dp[10000]=1;

	//clog<<"x"<<endl;

	repi(itr,X){

		//clog<<(*itr)<<" ";

		for(int i=0;i<20000;i++){

			if(*itr +i >=20000 or i-*itr  <0 or dp[i]==-1){

				continue;

			}

			chmax(bef[i+*itr],dp[i]+1);

			chmax(bef[i-*itr],dp[i]+1);

		}

		dp=bef;

	}

	if(X.size()!=0){

	ans&=(dp[x]==X.size()+1);}else{

		ans&=(10000==x);

	}

	//clog<<endl<<ans<<endl;

	//clog<<dp[x]<<endl;

	rep(i,20000){

		dp[i]=-1;

		bef[i]=-1;

	}

	dp[10000]=1;

	//clog<<"y"<<endl;

	repi(itr, Y)

	{

	//	clog << (*itr) << " ";

		for (int i = 0; i < 20000; i++)

		{

			if (*itr + i >= 20000 or i - *itr < 0 or dp[i] == -1)

			{

				continue;

			}

			chmax(bef[i + *itr], dp[i] + 1);

			chmax(bef[i - *itr], dp[i] + 1);

		}

		dp = bef;

	}

	//ans &= (dp[y] == Y.size()+1);

	if (Y.size() != 0)

	{

		ans &= (dp[y] == Y.size() + 1);

	}

	else

	{

		ans &= (10000 == y);

	}

	//clog<<endl << ans << endl;

	cout<<solve(ans)<<endl;

}//clog

// Faster C++ solution for the same problem (measured speedup: 1.2246759630204316x):
#include <bits/stdc++.h>

using ll = long long;

using namespace std;

#define rep(i, n) for (int i = 0, i##_len = (int)(n); i < i##_len; i++)

#define reps(i, n) for (int i = 1, i##_len = (int)(n); i <= i##_len; i++)

#define rrep(i, n) for (int i = ((int)(n)-1); i >= 0; i--)

#define rreps(i, n) for (int i = ((int)(n)); i > 0; i--)

#define repi(i, x) for (auto i = (x).begin(), i##_fin = (x).end(); i != i##_fin; i++)

#define all(x) (x).begin(), (x).end()

#define F first

#define S second

#define mp make_pair

#define pb push_back

#define solve(a) ((a) ? "Yes" : "No")

typedef vector<int> Vi;

typedef vector<Vi> VVi;

typedef pair<int, int> Pi;

typedef vector<Pi> VPi;

typedef vector<long long> V;

typedef vector<V> VV;

typedef pair<long long, long long> P;

typedef vector<P> VP;

template <class T>

inline bool chmax(T &a, T b)

{

	if (a < b)

	{

		a = b;

		return 1;

	}

	return 0;

}

template <class T>

inline bool chmin(T &a, T b)

{

	if (a > b)

	{

		a = b;

		return 1;

	}

	return 0;

}

const long long INFLL = 1LL << 60;

const int INF = 1 << 30;

const double PI = acos(-1);

int main()

{

	string s;

	int x, y;

	bool ans = true;

	cin >> s >> x >> y;

	x += 10000;

	y += 10000;

	VVi dis(2);

	int cnt = 0;

	int sw = 0;

	dis[0].push_back(0);

	dis[1].push_back(0);

	rep(i, s.size())

	{

		if (s[i] == 'T')

		{

			if (sw == 0)

			{

				x -= cnt;

			}

			else if (cnt != 0)

			{

				dis[sw % 2].push_back(cnt);

			}

			cnt = 0;

			sw++;

		}

		else

		{

			cnt++;

		}

	}

	if (sw == 0)

	{

		x -= cnt;

	}

	else if (cnt != 0)

	{

		dis[sw % 2].push_back(cnt);

	}

	

	vector<vector<bool>> dp(dis[0].size() + 1, vector<bool>(20000, false));

	dp[0][10000] = true;

	for (int i = 0; i < (int)dis[0].size(); i++)

	{

		for (int j = 0; j < 19999; j++)

		{

			if (dp[i][j] == false)

			{

				continue;

			}

			//	clog<<j<<" ";

			if (j + dis[0][i] < 20000)

			{

				dp[i + 1][j + dis[0][i]] = true;

			}

			if (j - dis[0][i] > 0)

			{

				dp[i + 1][j - dis[0][i]] = true;

			}

		}

		//	clog<<endl;

	}

	if(x<0 or x> 20000){

		ans=false;

	}else{

	ans &= dp[dis[0].size()][x];

	}vector<vector<bool>> dp2(dis[1].size() + 1, vector<bool>(20000, false));

	dp2[0][10000] = true;

	for (int i = 0; i < (int)dis[1].size(); i++)

	{

		for (int j = 0; j < 19999; j++)

		{

			if (dp2[i][j] == false)

			{

				continue;

			}

			if (j + dis[1][i] < 20000)

			{

				dp2[i + 1][j + dis[1][i]] = true;

			}

			if (j - dis[1][i] > 0)

			{

				dp2[i + 1][j - dis[1][i]] = true;

			}

		}

	}

		ans &= dp2[dis[1].size()][y];

		cout << solve(ans) << endl;

}