#include <cstdio>
#include <functional>
#include <algorithm>
#include <vector>
#include <limits>
#include <numeric>
#include <type_traits>
#include <iostream>
#include <queue>
#include <math.h>
#include <bits/stdc++.h>
#include <queue>
#include <map>

using namespace std;

#define INF (1ll<<60)
#define INFint (1<<30)
#define MOD 1000000007
#define BOUND 27182818284

typedef long long ll;
typedef long long int lli;
// typedef pair<ll,ll> P;

#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define repi(i,a,b) for(int i=int(a);i<int(b);++i)

template<class T>
bool umax(T &a, const T &b){
    if (a<b) {
        a=b; return true;
    }
    return false;
}

template<class T>
bool umin(T &a, const T &b) {
    if (b<a) {
        a=b; return true;
    }
    return false;
}

// gcd
template<typename T>
T gcd(T a, T b){
    if(a==0)
        return b;
    return gcd(b%a,a);
}

// gcd array
int findGCD(int arr[], int n){
    int result = arr[0];
    for (int i=1; i < n; i++)
        result = gcd(arr[i], result);
    return result;
}

template<typename T>
T lcm( T m, T n ){
    // 引数に0がある場合は0を返す
    if ( ( 0 == m ) || ( 0 == n ) )
        return 0;
    return ((m/gcd(m, n)) * n); // lcm = m * n / gcd(m,n)
}

template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
    fill( (T*)array, (T*)(array+N), val );
}


int dx[5]={1,0,-1,0};
int dy[5]={0,1,0,-1};

// v.front() = -BOUND;
// v.back() = BOUND;

//struct edge{
//    int cost, to;
//
//    edge(int in_cost, int in_to){
//        cost=in_cost;
//        to=in_to;
//    }
//    bool operator<(const edge &a) const
//    {
//        return cost > a.cost;
//    }
//};

ll d[8001];
int main() {
    string S; cin >> S;
    int X,Y; cin >> X >> Y;
    Fill(d, 0LL);

    if(S[S.size()-1]!='T') {
        S += 'T'; // 処理の簡単化のため最後に足す
    }

    int t_num=0; // 何回 T が登場したか
    int step=0;
    vector<int>go_back, up_down; // 前後上下
    for(int i=0; i<S.size(); i++){
        if(S[i]=='T'){
            t_num++;
            if(t_num%2==1){
                go_back.push_back(step);
            }else{
                up_down.push_back(step);
            }
            step=0;
        }else{
            step++;
        }
    }

    // go_back 一回目は必ずx軸正方向なので補正
    X-=go_back[0], go_back[0]=0;

    vector<int> ans_go_back, ans_up_down;
    ans_go_back.push_back(0);
    ans_up_down.push_back(0);
    for(auto& x: go_back){
        map<int,bool>mp;
        for(auto &a: ans_go_back){
            mp[a-x]=true;
            mp[a+x]=true;
        }
        ans_go_back.erase(ans_go_back.begin(), ans_go_back.end());
        for(auto &y: mp){
            ans_go_back.push_back(y.first);
        }
    }

    for(auto& x: up_down){
        map<int,bool>mp;
        for(auto &a: ans_up_down){
            mp[a-x]=true;
            mp[a+x]=true;
        }
        ans_up_down.erase(ans_up_down.begin(), ans_up_down.end());
        for(auto &y: mp){
            ans_up_down.push_back(y.first);
        }
    }

    bool f1= false, f2= false;
    for(auto x: ans_go_back){
        if(x==X){
            f1=true;
        }
    }
    for(auto x: ans_up_down){
        if(x==Y){
            f2=true;
        }
    }

    if(f1 && f2){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }

    return 0;
}


Measured memory_bytes: 512