#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <cstring>
#include <math.h>
#include <bitset>
#include <queue>
#include <set>
#include <iomanip>
#include <assert.h>
#include <cstdio>

// #include<bits/stdc++.h>
using namespace std;
typedef long long ll;
constexpr long long int INFLL = 1001001001001001LL;
constexpr long long int infll = 1001001001001001LL;
constexpr int INF = 1000000007;
constexpr int inf = 1000000007;
const int mod = 1000000007;

inline bool chmin(ll &a, ll b)
{
    if (a > b)
    {
        a = b;
        return true;
    }
    return false;
}

inline bool chmax(ll &a, ll b)
{
    if (a < b)
    {
        a = b;
        return true;
    }
    return false;
}

template <typename T>
T seinomi(T a)
{
    if (a > 0)
    {
        return a;
    }
    else
    {
        return 0;
    }
}

//桁数取得
template <typename T>
T ketasuu(T num)
{
    return std::to_string(num).length();
}
//整数乗
ll llpow(ll a, ll n)
{
    if (n == 0)
    {
        return 1;
    }
    else
    {
        ll rep = a;
        for (ll i = 1; i < n; i++)
        {
            rep *= a;
        }
        return rep;
    }
}

template <class ForwardIt, class T>
void iota(ForwardIt first, ForwardIt last, T value)
{
    while (first != last)
    {
        *first++ = value;
        ++value;
    }
}

template <typename T>
T amarinasi(T a, T b)
{
    if (a % b == 0)
    {
        return a / b;
    }
    else if (a % b > 0)
    {
        return a / b + 1;
    }
    else
    {
        return a / b - 1;
    }
}

//小数点以下10桁テンプレート（main関数内の最初に貼付け）
//std::cout << std::fixed << std::setprecision(10);

//----------------------------------------------------------------
const double pi = 3.14159265358979323846264;
vector<ll> dpx(20010, 0);
vector<ll> dpy(20010, 0);
int main()
{
    string s;
    cin >> s;
    ll x, y;
    cin >> x >> y;
    ll saisho = 0;
    bool yoko = true;
    ll yokocnt = 0;
    ll tatecnt = 0;
    for (ll i = 0; i < s.size(); i++)
    {
        if (s[i] == 'T')
        {
            break;
        }
        saisho++;
    }
    s.push_back('T');
    vector<ll> t;
    ll tmp_cnt = 0;
    for (ll i = saisho; i < s.size(); i++)
    {
        if (s[i] == 'T')
        {
            t.push_back(tmp_cnt);
            t.push_back(-1);
            tmp_cnt = 0;
        }
        else
        {
            tmp_cnt++;
        }
    }
    dpx[10000 + saisho] = 1;
    dpy[10000] = 1;
    for (ll i = 0; i < t.size(); i++)
    {
        if (t[i] == -1)
        {
            yoko = !yoko;
        }
        else
        {
            if (yoko)
            {
                vector<ll> tmp;
                for (ll j = 1000; j < 19000; j++)
                {
                    if (dpx[j] == 1)
                    {
                        tmp.push_back(j);
                        dpx[j] = 0;
                    }
                }
                for (auto f : tmp)
                {
                    dpx[f + t[i]] = 1;
                    dpx[f - t[i]] = 1;
                }
            }
            else
            {
                vector<ll> tmp;
                for (ll j = 1000; j < 19000; j++)
                {
                    if (dpy[j] == 1)
                    {
                        tmp.push_back(j);
                        dpy[j] = 0;
                    }
                }
                for (auto f : tmp)
                {
                    dpy[f + t[i]] = 1;
                    dpy[f - t[i]] = 1;
                }
            }
        }
    }
    if (dpx[10000 + x] == 1 && dpy[10000 + y] == 1)
    {
        cout << "Yes" << endl;
    }
    else
    {
        cout << "No" << endl;
    }
}


Measured memory_bytes: 3940