import sys



def main():

    input = sys.stdin.readline

    S = [str(c) for c in input().strip()]

    X, Y = list(map(int, input().split()))

    F = []

    while len(S) > 0:

        f = 0

        while len(S) > 0 and S[0] == 'F':

            f += 1

            S.pop(0)

        F.append(f)

        if len(S) > 0:

            S.pop(0)



    Fx = []

    Fy = []

    for i in range(1, len(F)):

        if i % 2 == 0:

            Fx.append(F[i])

        else:

            Fy.append(F[i])



    dpx = [[F[0]]] + [0] * len(Fx)

    for i in range(len(Fx)):

        nx = set()

        for a in dpx[i]:

            nx.add(a + Fx[i])

            nx.add(a - Fx[i])

        dpx[i+1] = nx



    dpy = [[0]] + [0] * len(Fy)

    for i in range(len(Fy)):

        ny = set()

        for a in dpy[i]:

            ny.add(a + Fy[i])

            ny.add(a - Fy[i])

        dpy[i+1] = ny





    if X in dpx[-1] and Y in dpy[-1]:

        print('Yes')

    else:

        print('No')





if __name__ == '__main__':

    main()

import sys



def main():

    input = sys.stdin.readline

    S = [str(c) for c in input().strip()]

    X, Y = list(map(int, input().split()))

    move = []



    S.append('E')

    while len(S) > 0:

        f = 0

        while len(S) > 0 and S[0] == 'F':

            f += 1

            S.pop(0)

        move.append(f)

        S.pop(0)



    X -= move[0]

    move_x = []

    move_y = []

    for i in range(1, len(move)):

        if i % 2 == 0:

            move_x.append(move[i])

        else:

            move_y.append(move[i])



    move_x = sorted(move_x, key=lambda x: -x)

    move_y = sorted(move_y, key=lambda x: -x)

    

    for mv in move_x:

        if X > 0:

            X -= mv

        else:

            X += mv



    for my in move_y:

        if Y > 0:

            Y -= my

        else:

            Y += my



    if X == Y == 0:

        print('Yes')

    else:

        print('No')





if __name__ == '__main__':

    main()

import sys


def main():
    input = sys.stdin.readline
    S = [str(c) for c in input().strip()]
    X, Y = list(map(int, input().split()))
    F = []
    while len(S) > 0:
        f = 0
        while len(S) > 0 and S[0] == "F":
            f += 1
            S.pop(0)
        F.append(f)
        if len(S) > 0:
            S.pop(0)
    Fx = []
    Fy = []
    for i in range(1, len(F)):
        if i % 2 == 0:
            Fx.append(F[i])
        else:
            Fy.append(F[i])
    dpx = [[F[0]]] + [0] * len(Fx)
    for i in range(len(Fx)):
        nx = set()
        for a in dpx[i]:
            nx.add(a + Fx[i])
            nx.add(a - Fx[i])
        dpx[i + 1] = nx
    dpy = [[0]] + [0] * len(Fy)
    for i in range(len(Fy)):
        ny = set()
        for a in dpy[i]:
            ny.add(a + Fy[i])
            ny.add(a - Fy[i])
        dpy[i + 1] = ny
    if X in dpx[-1] and Y in dpy[-1]:
        print("Yes")
    else:
        print("No")


if __name__ == "__main__":
    main()

import sys


def main():
    input = sys.stdin.readline
    S = [str(c) for c in input().strip()]
    X, Y = list(map(int, input().split()))
    move = []
    S.append("E")
    while len(S) > 0:
        f = 0
        while len(S) > 0 and S[0] == "F":
            f += 1
            S.pop(0)
        move.append(f)
        S.pop(0)
    X -= move[0]
    move_x = []
    move_y = []
    for i in range(1, len(move)):
        if i % 2 == 0:
            move_x.append(move[i])
        else:
            move_y.append(move[i])
    move_x = sorted(move_x, key=lambda x: -x)
    move_y = sorted(move_y, key=lambda x: -x)
    for mv in move_x:
        if X > 0:
            X -= mv
        else:
            X += mv
    for my in move_y:
        if Y > 0:
            Y -= my
        else:
            Y += my
    if X == Y == 0:
        print("Yes")
    else:
        print("No")


if __name__ == "__main__":
    main()

-    F = [] +    move = [] +    S.append("E") -        F.append(f) -        if len(S) > 0: -            S.pop(0) -    Fx = [] -    Fy = [] -    for i in range(1, len(F)): +        move.append(f) +        S.pop(0) +    X -= move[0] +    move_x = [] +    move_y = [] +    for i in range(1, len(move)): -            Fx.append(F[i]) +            move_x.append(move[i]) -            Fy.append(F[i]) -    dpx = [[F[0]]] + [0] * len(Fx) -    for i in range(len(Fx)): -        nx = set() -        for a in dpx[i]: -            nx.add(a + Fx[i]) -            nx.add(a - Fx[i]) -        dpx[i + 1] = nx -    dpy = [[0]] + [0] * len(Fy) -    for i in range(len(Fy)): -        ny = set() -        for a in dpy[i]: -            ny.add(a + Fy[i]) -            ny.add(a - Fy[i]) -        dpy[i + 1] = ny -    if X in dpx[-1] and Y in dpy[-1]: +            move_y.append(move[i]) +    move_x = sorted(move_x, key=lambda x: -x) +    move_y = sorted(move_y, key=lambda x: -x) +    for mv in move_x: +        if X > 0: +            X -= mv +        else: +            X += mv +    for my in move_y: +        if Y > 0: +            Y -= my +        else: +            Y += my +    if X == Y == 0: