import std.stdio, std.string, std.range, std.conv, std.array, std.algorithm, std.math, std.typecons;

void main() {
    auto s = readln.chomp;
    auto goal = readln.split.to!(int[]);
    struct Move{
        bool x;
        int d;
    }
    Move[] moves;
    moves ~= Move(true, 0);
    int x = 0, y = 0;
    bool firstFlag = true;
    foreach (c; s) {
        if (c == 'F') {
            if (firstFlag) {
                x++;
            } else {
                moves[$-1].d++;
            }
        } else {
            firstFlag = false;
            moves ~= Move(!moves[$-1].x, 0);
        }
    }
    auto xmoves = moves.filter!(m => m.x).map!(m => m.d).array;
    auto ymoves = moves.filter!(m => !m.x).map!(m => m.d).array;
    bool[Tuple!(size_t,int)] memo;
    bool func(int x, int g, int[] d) {
        if (auto r = tuple(d.length, x) in memo) return *r;
        if (d.empty) return x == g;
        return memo[tuple(d.length, x)] = func(x+d.front, g, d[1..$]) || func(x-d.front, g, d[1..$]);
    }
    auto xok = func(x, goal[0], xmoves);
    memo = null;
    auto yok = func(y, goal[1], ymoves);
    writeln(xok && yok ? "Yes" : "No");
}

