#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<algorithm>
#include<vector>
#include<string>
#include<sstream>
#include<iomanip>
#include<utility>
#include<cmath>
#include<set>
#include<list>
#include<queue>
#include<stack>
#include<deque>
#include<map>
#include<set>
#include<cstring>
#include<iterator>
#include<bitset>
using namespace std;
 
struct edge {int /*from,*/to,cost;};
typedef long long ll;
typedef pair<int,int> P;
typedef pair<int,pair<int,int> > PP;
typedef vector<int> VI;
typedef vector<long long int> VL;
typedef vector<edge> VE;
static const int MOD = 1000000007;
//static const int INF = 2147483647;
//static const long long INF = 9223372000000000000;
//static const long long INF = 9223372000000000000/2;
//static const int INF = 1000010000;
//int dx4[4] = {0,1,0,-1}, dy4[4] = {-1,0,1,0};
//int dx5[5] = {-1,0,0,0,1}, dy5[5] = {0,-1,0,1,0};
//int dx8[8] = {-1,0,1,1,1,0,-1,-1}, dy8[8] = {1,1,1,0,-1,-1,-1,0};
//int dx9[9] = {-1,0,1,1,1,0,-1,-1,0}, dy9[9] = {1,1,1,0,-1,-1,-1,0,0};
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define np next_permutation
#define pq priority_queue
#define UB upper_bound
#define LB lower_bound
#define SZ(a) int((a).size())
#define LEN(a) int((a).length())
#define MAX(a,b,c) max((a),max((b),(c)))
#define MIN(a,b,c) min((a),min((b),(c)))
#define SORT(c) sort((c).begin(),(c).end())
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,x) for(int i=0;i<(int)(x);i++)
#define REP1(i,x) for(int i=1;i<=(int)(x);i++)
#define RREP(i,x) for(int i=((int)(x)-1);i>=0;i--)
#define RREP1(i,x) for(int i=((int)(x));i>0;i--)
//#define int ll

signed main(){
    string s;
    cin >> s;
    s = s + 'T';
    int len = LEN(s);
    int x,y;
    scanf("%d%d",&x,&y);

    VI tate;
    VI yoko;
    int q = 0, t = 0;
    int sx;
    bool rullonz = true;
    REP(i,len){
        if(s[i]=='T'){
            if(rullonz){
                sx = q;
                rullonz = false;
            } else if(t%2){
                if(q!=0) tate.pb(q);
            } else {
                if(q!=0) yoko.pb(q);
            }
            q = 0;
            t++;
        }
        else q++;
    }
    /*printf("%d\n",sx);
    REP(i,SZ(tate)) printf("%d ",tate[i]);
    printf("\n");
    REP(i,SZ(yoko)) printf("%d ",yoko[i]);
    printf("\n");*/

    int tt[114514],yk[114514],tt2[114514],yk2[114514];
    REP(i,114514){
        tt[i] = -1;
        yk[i] = -1;
        tt2[i] =-1;
        yk2[i] =-1;
    }
    tt[50000] = yk[50000] = 0;
    int ue = 50000,st = 50000;
    REP(i,SZ(tate)){
        int m = tate[i];
        if(i%2){
            for(int j=st;j<=ue;j++){
                if(tt2[j]==i){
                    tt[j+m] = i + 1;
                    tt[j-m] = i + 1;
                }
            }
            ue += m;
            st -= m;
        } else {
            for(int j=st;j<=ue;j++){
                if(tt[j]==i){
                    tt2[j+m] = i + 1;
                    tt2[j-m] = i + 1;
                }
            }
            ue += m;
            st -= m;
        }
    }

    /*for(int i=st;i<=ue;i++){
        printf("%d ",i);
    }
    printf("\n");
    for(int i=st;i<=ue;i++){
        printf("%d ",i-st);
    }
    printf("\n");
    for(int i=st;i<=ue;i++){
        printf("%d ",tt[i]);
    }
    printf("\n");
    for(int i=st;i<=ue;i++){
        printf("%d ",tt2[i]);
    }*/

    ue = st = 50000;
    REP(i,SZ(yoko)){
        int m = yoko[i];
        if(i%2){
            for(int j=st;j<=ue;j++){
                if(yk2[j]==i){
                    yk[j+m] = i + 1;
                    yk[j-m] = i + 1;
                }
            }
            ue += m;
            st -= m;
        } else {
            for(int j=st;j<=ue;j++){
                if(yk[j]==i){
                    yk2[j+m] = i + 1;
                    yk2[j-m] = i + 1;
                }
            }
            ue += m;
            st -= m;
        }
    }

    /*printf("\n");
    for(int i=st;i<=ue;i++){
        printf("%d ",yk[i]);
    }
    printf("\n");
    for(int i=st;i<=ue;i++){
        printf("%d ",yk2[i]);
    }*/

    int p = SZ(tate), r = SZ(yoko);
    if((tt[y+50000]==p||tt2[y+50000]==p)
        &&(yk[x+50000-sx]==r||yk2[x+50000-sx]==r)) puts("Yes");
    else puts("No");
    return 0;
}

Measured memory_bytes: 2048