#include <cassert>
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <cwchar>
#include <cwctype>
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#include <array>
#include <atomic>
#include <chrono>
#include <codecvt>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
#define all(x) (x).begin(),(x).end()
#pragma GCC optimize("Ofast")
using namespace std;
typedef long long int ll;
typedef long double ld;
const ll INF=(1LL<<62);
const ld pi=acosl((ld)-1);
// const ll mod = 1000000007;
const ll mod = 1234567;
const int dx[4]={0,1,0,-1};
const int dy[4]={1,0,-1,0};
const int ddx[8]={1,0,-1,-1,-1,0,1,1};
const int ddy[8]={1,1,1,0,-1,-1,-1,0};
#define endn "\n"

bool solve(){
    string s;cin>>s;
    s.push_back('T');
    ll x,y;cin>>x>>y;
    bool isX=true;
    ll num=0;
    vector<ll>vx,vy;
    rep(i,s.size()){
        if(s[i]=='T'){
            if(isX)vx.push_back(num);
            if(!isX)vy.push_back(num);
            isX=!isX;
            num=0;
        }else num++;
    }
    // for(auto&&i:vx)cout<<i<<endl;

    bool ans=true;
    int mid=10000;

    //X
    {
        bool dp[vx.size()+1][mid*2];
        rep(i,(int)vx.size()+1)rep(j,mid*2)dp[i][j]=false;
        dp[0][mid]=true;
        rep(i,vx.size())rep(j,mid*2){
            if(!dp[i][j])continue;
            if(i==0){
                if(j+vx[i]<2*mid)dp[i+1][j+vx[i]]=true;
                continue;
            }
            if(j+vx[i]<2*mid)dp[i+1][j+vx[i]]=true;
            if(j-vx[i]>0)dp[i+1][j-vx[i]]=true;
        }
        if(!dp[vx.size()][mid+x])ans=false;
    }

    //Y
    {
        bool dp[vy.size()+1][mid*2];
        rep(i,(int)vy.size()+1)rep(j,mid*2)dp[i][j]=false;
        dp[0][mid]=true;
        rep(i,vy.size())rep(j,mid*2){
            if(!dp[i][j])continue;
            if(j+vy[i]<2*mid)dp[i+1][j+vy[i]]=true;
            if(j-vy[i]>0)dp[i+1][j-vy[i]]=true;
        }
        if(!dp[vy.size()][mid+y])ans=false;
    }

    cout<<(ans ? "Yes" : "No")<<endl;
    return false;
}

signed main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout<<fixed<<setprecision(30);
    solve();
}


Measured memory_bytes: 77824