import core.bitop, std.algorithm, std.ascii, std.bigint, std.conv, std.math,
    std.functional, std.numeric, std.range, std.stdio, std.string, std.random,
    std.typecons, std.container, std.format;
static import std.ascii;

// dfmt off
T lread(T = long)(){return readln.chomp.to!T();}
T[] lreads(T = long)(long n){return generate(()=>readln.chomp.to!T()).take(n).array();}
T[] aryread(T = long)(){return readln.split.to!(T[])();}
void scan(TList...)(ref TList Args){auto line = readln.split();
foreach (i, T; TList){T val = line[i].to!(T);Args[i] = val;}}
alias sread = () => readln.chomp();enum MOD = 10 ^^ 9 + 7;
alias PQueue(T, alias less = "a<b") = BinaryHeap!(Array!T, less);
// dfmt on

void main()
{
    auto S = sread();
    long N = S.length;
    long X, Y;
    scan(X, Y);

    auto ls = new long[][](2, 1);
    {
        long s;
        foreach (i; 0 .. N)
        {
            if (S[i] == 'T')
            {
                ls[s] ~= 0;
                s = s ^ 1;
            }
            if (S[i] == 'F')
            {
                ls[s][$ - 1]++;
            }
        }
    }
    {
        bool[long] D;
        D[ls[0][0]] = true;
        foreach (j; ls[0][1 .. $])
        {
            bool[long] D2;
            foreach (k; D.byKey)
            {
                D2[k + j] = D2[k - j] = true;
            }
            D = D2;
        }
        if (X !in D)
        {
            writeln("No");
            return;
        }
    }
    {
        bool[long] D;
        D[0] = true;
        foreach (j; ls[1])
        {
            bool[long] D2;
            foreach (k; D.byKey)
            {
                D2[k + j] = D2[k - j] = true;
            }
            D = D2;
        }
        if (Y !in D)
        {
            writeln("No");
            return;
        }
    }
    writeln("Yes");

}
