def main():

    SFT = 8000



    CMDs = list(map(len, input().split('T')))

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



    # [-SFT,SFT] -> [0,SFT*2]

    axis = 0

    curr = [1 << (next(CMDs) + SFT), 1 << SFT]

    for d in CMDs:

        axis ^= 1

        curr[axis] = (curr[axis] >> d) | (curr[axis] << d)



    cond = (curr[0] >> (SFT + X)) & 1 and (curr[1] >> (SFT + Y)) & 1

    print(('Yes' if cond else 'No'))





if __name__ == '__main__':

    main()

def main():

    *CMDs, = list(map(len, input().split('T')))

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



    X -= CMDs[0]  # この操作だけは対称性がない



    def is_reachable(cmds, goal):

        SFT = 8000

        # [-SFT,SFT] -> [0,SFT*2]

        dp = 1 << SFT

        for d in cmds:

            dp = (dp >> d) | (dp << d)

        return SFT + goal >= 0 and (dp >> (SFT + goal)) & 1  # negative_shiftでRE



    cond = is_reachable(CMDs[2::2], X) and is_reachable(CMDs[1::2], Y)

    print(('Yes' if cond else 'No'))





if __name__ == '__main__':

    main()



# RE

# CMDs = [8000, 0]

# X, Y = -8000, 0

def main():
    SFT = 8000
    CMDs = list(map(len, input().split("T")))
    X, Y = list(map(int, input().split()))
    # [-SFT,SFT] -> [0,SFT*2]
    axis = 0
    curr = [1 << (next(CMDs) + SFT), 1 << SFT]
    for d in CMDs:
        axis ^= 1
        curr[axis] = (curr[axis] >> d) | (curr[axis] << d)
    cond = (curr[0] >> (SFT + X)) & 1 and (curr[1] >> (SFT + Y)) & 1
    print(("Yes" if cond else "No"))


if __name__ == "__main__":
    main()

def main():
    (*CMDs,) = list(map(len, input().split("T")))
    X, Y = list(map(int, input().split()))
    X -= CMDs[0]  # この操作だけは対称性がない

    def is_reachable(cmds, goal):
        SFT = 8000
        # [-SFT,SFT] -> [0,SFT*2]
        dp = 1 << SFT
        for d in cmds:
            dp = (dp >> d) | (dp << d)
        return SFT + goal >= 0 and (dp >> (SFT + goal)) & 1  # negative_shiftでRE

    cond = is_reachable(CMDs[2::2], X) and is_reachable(CMDs[1::2], Y)
    print(("Yes" if cond else "No"))


if __name__ == "__main__":
    main()
# RE
# CMDs = [8000, 0]
# X, Y = -8000, 0

-    SFT = 8000 -    CMDs = list(map(len, input().split("T"))) +    (*CMDs,) = list(map(len, input().split("T"))) -    # [-SFT,SFT] -> [0,SFT*2] -    axis = 0 -    curr = [1 << (next(CMDs) + SFT), 1 << SFT] -    for d in CMDs: -        axis ^= 1 -        curr[axis] = (curr[axis] >> d) | (curr[axis] << d) -    cond = (curr[0] >> (SFT + X)) & 1 and (curr[1] >> (SFT + Y)) & 1 +    X -= CMDs[0]  # この操作だけは対称性がない + +    def is_reachable(cmds, goal): +        SFT = 8000 +        # [-SFT,SFT] -> [0,SFT*2] +        dp = 1 << SFT +        for d in cmds: +            dp = (dp >> d) | (dp << d) +        return SFT + goal >= 0 and (dp >> (SFT + goal)) & 1  # negative_shiftでRE + +    cond = is_reachable(CMDs[2::2], X) and is_reachable(CMDs[1::2], Y) +# RE +# CMDs = [8000, 0] +# X, Y = -8000, 0