import std.stdio, std.conv, std.string;
import std.algorithm, std.array, std.container, std.typecons;
import std.numeric, std.math;
import core.bitop;

T RD(T = string)() { static string[] ss; while(!ss.length) ss = readln.chomp.split; string res = ss[0]; ss.popFront; return res.to!T; }
string RDR()() { return readln.chomp; }
T[] ARR(T)(in string str) { return str.split.to!(T[]); }
size_t[] MAKE_IDX(alias less = "a < b", Range)(Range range) { auto idx = new size_t[](range.length); makeIndex!(less)(range, idx); return idx;}
size_t MIN_POS(alias less = "a < b", Range)(Range range) { auto r = minPos!(less)(range); return range.length - r.length; }

bool INSIDE(T)(T x, T b, T e) { return x >= b && x < e; }

long mod = pow(10, 9) + 7;
void moda(ref long x, long y) { x = (x + y) % mod; }
void mods(ref long x, long y) { x = ((x + mod) - (y % mod)) % mod; }
void modm(ref long x, long y) { x = (x * y) % mod; }

struct UnionFind
{
	void init(long n) { par = new long[](n); foreach (i; 0..n) par[i] = i; }
	long root(long i) { return par[i] == i ? i : (par[i] = root(par[i])); }
	bool same(long i, long j) { return root(i) == root(j); }
	void unite(long i, long j) { i = root(i); j = root(j); if (i == j) return; par[i] = j; }
	long[] par;
}

void main()
{
	auto S = RD!string;
	auto x = RD!long;
	auto y = RD!long;

	long cnt;
	foreach (c; S)
	{
		if (c == 'F')
			++cnt;
		else
			break;
	}
	x -= cnt;
	long[][2] moves;
	long streak;
	long mode;
	foreach (c; S[cnt..$])
	{
		if (c == 'T')
		{
			moves[mode] ~= streak;
			streak = 0;
			mode ^= 1;
		}
		else
		{
			++streak;
		}
	}
	if (streak != 0) moves[mode] ~= streak;
	stderr.writeln(moves);
	
	bool ans = true;
	{
		long[long] memoLast;
		memoLast[0] = 1;
		foreach (e; moves[0])
		{
			long[long] memo;
			foreach (key; memoLast.keys)
			{
				memo[key+e] = 1;
				memo[key-e] = 1;
			}
			memoLast = memo;
		}
		stderr.writeln(memoLast);
		ans &= memoLast.get(x, 0) == 1;
	}
	{
		long[long] memoLast;
		memoLast[0] = 1;
		foreach (e; moves[1])
		{
			long[long] memo;
			foreach (key; memoLast.keys)
			{
				memo[key+e] = 1;
				memo[key-e] = 1;
			}
			memoLast = memo;
		}
		stderr.writeln(memoLast);
		ans &= memoLast.get(y, 0) == 1;
	}

	writeln(ans ? "Yes" : "No");
	stdout.flush();
}