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 .. $];

    debug {
        writeln(xb);
        writeln(s);
    }

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

    xys[0] = xys[0].filter!"a > 0".array;
    xys[1] = xys[1].filter!"a > 0".array;

    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[][](n + 1, 40001);
    dp[0][20000] = 1;

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

        debug {
            writefln("%(%b %)", dp[i+1][20000 - 10 .. 20000 + 10]);
        }
    }

    return dp[n][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);
        }
    }
}