#include "bits/stdc++.h"
#include <chrono>
#include <random>
#include <cstdio>
#define ll long long int
#define endl '\n'
#define pb push_back
#define mp make_pair
#define mod 998244353LL
#define rep(i,n) for(ll i=0;i<n;i++)
#define vi vector <int>
#define vs vector <string>
#define vc vector <char>
#define vl vector <ll>
#define pll pair<ll, ll>
#define pint pair<int, int>
#define S second
#define F first
#define all(c) (c).begin(),(c).end()
using namespace std;
ll power(ll a,ll b) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
ll modInverse(ll a){return power(a,mod-2);}
const int N=500001;
ll gcd(ll a, ll b) { if (a == 0) return b; return gcd(b % a, a); } 
ll lcm(ll a, ll b){return a*b/gcd(a, b);}
#define pi 3.14159265358979323846264338
using namespace std; 
ll max(ll a, ll b){ if(a>b)return a;return b;}
ll min(ll a, ll b){ if(a < b) return a;return b;}
ll inf = 100000000000000000;

void solve() 
{
    string s;
    cin>>s;

    int x, y;
    cin>>x>>y;

    vi d, xv, yv;
    d.pb(-1);

    int cnt = 0;

    rep(i, s.size())
    {
        if(s[i] == 'F') cnt++;
        else
        {
            d.pb(cnt);
            cnt = 0;
        }
    }
    if(cnt > 0) d.pb(cnt);

    for(int i = 2; i < d.size(); i++)
    {
        if(i%2 == 0) yv.pb(d[i]);
        else xv.pb(d[i]);
    }

    int n = d.size();

    bool dp[n+1][16000];

    rep(i, n+1)
    {
        rep(j, 16000) dp[i][j] = false;
    }

    dp[0][8000] = true;
    dp[1][d[1] + 8000] = true;
    // cout<<d[1]<<endl;
    // cout<<xv[0]<<endl;

    for(int i = 2; i < xv.size() + 2; i++)
    {
        // cout<<xv[i-2]<<endl;
        rep(j, 16000)
        {
            if(dp[i-1][j-xv[i-2]] == true || dp[i-1][j+xv[i-2]] == true)
            {
                dp[i][j] = true;
            }
        }
    }

    // rep(i, xv.size() + 2)
    // {
    //     for(int j = 7995; j < 8020; j++)
    //     {
    //         cout<<dp[i][j]<<" ";
    //     }
    //     cout<<endl;
    // }


    if(dp[xv.size() + 1][x + 8000] != true)
    {
        cout<<"No"<<endl;
        return;
    }

    rep(i, n+1)
    {
        rep(j, 16000) dp[i][j] = false;
    }

    dp[0][8000] = true;
    // dp[1][d[1] + 8000] = true;
    // cout<<d[1]<<endl;
    // cout<<xv[0]<<endl;

    for(int i = 1; i < yv.size() + 1; i++)
    {
        // cout<<xv[i-2]<<endl;
        rep(j, 16000)
        {
            if(dp[i-1][j-yv[i-1]] == true || dp[i-1][j+yv[i-1]] == true)
            {
                dp[i][j] = true;
            }
        }
    }

    // rep(i, yv.size() + 1)
    // {
    //     for(int j = 7995; j < 8020; j++)
    //     {
    //         cout<<dp[i][j]<<" ";
    //     }
    //     cout<<endl;
    // }


    if(dp[yv.size()][y + 8000] != true)
    {
        cout<<"No"<<endl;
        return;
    }

    cout<<"Yes"<<endl;
}

int main()
{   

    #ifndef ONLINE_JUDGE
        // for getting input from input.txt
        freopen("input.txt", "r", stdin);
        // for writing output to output.txt
        freopen("output.txt", "w", stdout);
    #endif

    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int T=1;
    // cin>>T;
    int t=0;
    while(t++<T)
    {
        // cout<<"Case #"<<t<<":"<<' ';
        solve();
        // cout<<'\n';
    }
    cerr << "Time : " << 1000 * ((double)clock()) / (double)CLOCKS_PER_SEC << "ms\n";
}


Measured memory_bytes: 127796