def f(m, s, g):

    v, t = {s}, set()

    for i in m:

        for j in v:

            t.update((j+i, j-i))

        v, t = t, set()

    return g in v

s = eval(input())

x, y = list(map(int, input().split()))

m = list(map(len, s.split('T')))

if f(m[::2][1::], m[0], x) and f(m[1::2], 0, y):

    print('Yes')

else:

    print('No')
def f(m, s, g):

    for i in m:

        if s > g:

            s -= i

        else:

            s += i

    return s == g

s = eval(input())

x, y = list(map(int, input().split()))

m = list(map(len, s.split('T')))

if (f(sorted(m[::2][1::])[::-1], m[0], x)

        and f(sorted(m[1::2])[::-1], 0, y)):

    print('Yes')

else:

    print('No')
def f(m, s, g):
    v, t = {s}, set()
    for i in m:
        for j in v:
            t.update((j + i, j - i))
        v, t = t, set()
    return g in v


s = eval(input())
x, y = list(map(int, input().split()))
m = list(map(len, s.split("T")))
if f(m[::2][1::], m[0], x) and f(m[1::2], 0, y):
    print("Yes")
else:
    print("No")

def f(m, s, g):
    for i in m:
        if s > g:
            s -= i
        else:
            s += i
    return s == g


s = eval(input())
x, y = list(map(int, input().split()))
m = list(map(len, s.split("T")))
if f(sorted(m[::2][1::])[::-1], m[0], x) and f(sorted(m[1::2])[::-1], 0, y):
    print("Yes")
else:
    print("No")

-    v, t = {s}, set() -        for j in v: -            t.update((j + i, j - i)) -        v, t = t, set() -    return g in v +        if s > g: +            s -= i +        else: +            s += i +    return s == g -if f(m[::2][1::], m[0], x) and f(m[1::2], 0, y): +if f(sorted(m[::2][1::])[::-1], m[0], x) and f(sorted(m[1::2])[::-1], 0, y):