import std.stdio, std.string, std.conv, std.algorithm, std.numeric;
import std.range, std.array, std.math, std.typecons, std.container, core.bitop;

void main() {
    string s;
    scan(s);
    int x, y;
    scan(x, y);

    auto xys = new int[][](2, 0);
    auto tk = 0;
    auto xb = 0;

    while (xb < s.length.to!int && s[xb] == 'F') xb++;

    s = s[xb .. $];

    foreach (si ; s) {
        if (si == 'F') {
            xys[tk].back++;
        }
        else {
            tk ^= 1;
            xys[tk] ~= 0;
        }
    }

    debug {
        writeln(xys);
    }

    auto ans = knapsack(xys[0], x - xb) && knapsack(xys[1], y);

    writeln(ans ? "Yes" : "No");
}

bool knapsack(int[] x, int X) {
    int n = x.length.to!int;

    auto dp = new bool[][](2, 40001);
    dp[0][20000] = 1;

    foreach (i ; 0 .. n) {
        foreach (j ; 0 .. 40001) {
            if (j - x[i] >= 0) {
                dp[(i+1)&1][j - x[i]] |= dp[(i&1)][j];
            }
            if (j + x[i] < 40001) {
                dp[(i+1)&1][j + x[i]] |= dp[(i&1)][j];
            }
        }
    }

    debug {
        writefln("%(%b %)", dp[n&1][20000 - 5 .. 20000 + 5]);
    }

    return dp[n&1][X + 20000];
}


void scan(T...)(ref T args) {
    string[] line = readln.split;
    foreach (ref arg; args) {
        arg = line.front.to!(typeof(arg));
        line.popFront();
    }
    assert(line.empty);
}



void fillAll(R, T)(ref R arr, T value) {
    static if (is(typeof(arr[] = value))) {
        arr[] = value;
    }
    else {
        foreach (ref e; arr) {
            fillAll(e, value);
        }
    }
}