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

using namespace std;



string s;

int x, y;



int d[8000];

vector<int> vx;

vector<int> vy;



int main() {

    ios::sync_with_stdio(false);



    cin >> s;

    cin >> x >> y;

    

    //d[i] is length of F ith block

    //d[1] = value

    /*

    int index= 1;

    for (int i = 0; i < s.size(); i++) {

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

            //printf("F i=%d\n", i);

            int cnt = 0;

            for (int j = i; j < s.size() && s[j] != 'T'; j++)

                if (s[j] == 'F')

                    cnt++;

            d[index++] = cnt;

            i+= cnt;

        }

    }

    */

    

    int countF, countT;

    countF = countT = 0;

    for (int i = 0; i < s.size(); i++) {

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

            countF++;

        else {//meet T

            if (countT % 2 == 0) {//even is x postion move

                vx.push_back(countF);

            }

            else

                vy.push_back(countF);

            countT++;

            countF = 0;

        }

    }

    

    if (countF > 0) {

        if (countT % 2 == 0)

            vx.push_back(countF);

        else

            vy.push_back(countF);

    }

    

    bool dpx[vx.size()+1][16001];

    bool dpy[vy.size()+1][16001];

    memset(dpx, 0, sizeof(dpx));

    memset(dpy, 0, sizeof(dpy));

    

    

    int t = 0;

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

        dpx[0][8000] = true;//8000 is center

    else {

        dpx[1][8000+vx[0]] = true;

        t++;

    }

    

    for (int i = 0 + t; i < vx.size(); i++) {

        for (int j = 0; j < 16001; j++) {

            if(!dpx[i][j])

                continue;

            if (j - vx[i] >=0) {

                dpx[i+1][j-vx[i]] |= dpx[i][j];

            }

            if (j + vx[i] < 16001) {

                dpx[i+1][j+vx[i]] |= dpx[i][j];

            }

        }

    }

    dpy[0][8000] = true;

    

    for (int i = 0 ; i < vy.size(); i++) {

        for (int j = 0; j < 16001; j++) {

            if(!dpy[i][j])

                continue;

            if (j - vy[i] >=0)

                dpy[i+1][j-vy[i]] |= dpy[i][j];

            

            if (j + vy[i] < 16001)

                dpy[i+1][j+vy[i]] |= dpy[i][j];

        }

    }

    



    if (dpx[vx.size()][x+8000] && dpy[vy.size()][y+8000])

        cout << "Yes\n";

    else

        cout << "No\n";

    

    

    return 0;

}


// Faster C++ solution for the same problem (measured speedup: 1.1217398745402223x):


#include <bits/stdc++.h>

using namespace std;



string s;

int x, y;



int d[8000];

vector<int> vx;

vector<int> vy;

int sumx, sumy;

bool mycmp(const int& a, const int& b)

{

	return a>b;

}



int main() {

    ios::sync_with_stdio(false);

    cin >> s;

    cin >> x >> y;





    int countF, countT;

    countF = countT = 0;

    for (int i = 0; i < s.size(); i++) {

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

            countF++;

        else {//meet T

            if (countT % 2 == 0) {//even is x postion move

                vx.push_back(countF);

            }

            else

                vy.push_back(countF);

            countT++;

            countF = 0;

        }

    }



    if (countF > 0) {

        if (countT % 2 == 0)

            vx.push_back(countF);

        else

            vy.push_back(countF);

    }

    sort(vx.begin() + 1, vx.end(), mycmp);

	sort(vy.begin(), vy.end(), mycmp);

	sumx += vx[0];

	for (int i = 1; i<vx.size(); i++)

	{

		if (sumx <= x)

			sumx += vx[i];

		else

			sumx -= vx[i];

	}

	for (int i = 0; i<vy.size(); i++)

	{

		if (sumy <= y)

			sumy += vy[i];

		else

			sumy -= vy[i];

	}

	if (sumx == x&&sumy == y)

		printf("Yes");

	else

		printf("No");

	return 0;







    return 0;

}