# -*- coding: utf-8 -*-

import bisect

import heapq

import math

import random

import sys

from collections import Counter, defaultdict

from decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal

from functools import lru_cache, reduce

from itertools import combinations, combinations_with_replacement, product, permutations

from operator import add, mul



sys.setrecursionlimit(10000)





def read_int():

    return int(input())





def read_int_n():

    return list(map(int, input().split()))





def read_float():

    return float(input())





def read_float_n():

    return list(map(float, input().split()))





def read_str():

    return input()





def read_str_n():

    return list(map(str, input().split()))





def error_print(*args):

    print(*args, file=sys.stderr)





def mt(f):

    import time



    def wrap(*args, **kwargs):

        s = time.time()

        ret = f(*args, **kwargs)

        e = time.time()



        error_print(e - s, 'sec')

        return ret



    return wrap





move = None

tx = None

ty = None





@mt

def slv(S, x, y):

    tx = x

    ty = y

    move = list(map(lambda x: len(x), S.split('T')))

    xm = [move[0]]

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

        xm_ = []

        for x in xm:

            xm_.append(x + move[i])

            xm_.append(x - move[i])

        xm = set(xm_)



    ym = [0]

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

        ym_ = []

        for y in ym:

            ym_.append(y + move[i])

            ym_.append(y - move[i])

        ym = set(ym_)



    return 'Yes' if tx in xm and ty in ym else 'No'





def main():

    S = read_str().strip()

    x, y = read_int_n()

    print(slv(S, x, y))





if __name__ == '__main__':

    main()

# -*- coding: utf-8 -*-

import bisect

import heapq

import math

import random

from collections import Counter, defaultdict, deque

from decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal

from fractions import Fraction

from functools import lru_cache, reduce

from itertools import combinations, combinations_with_replacement, product, permutations, accumulate

from operator import add, mul, sub, itemgetter, attrgetter





import sys

# sys.setrecursionlimit(10**6)

# readline = sys.stdin.buffer.readline

readline = sys.stdin.readline



INF = 2**62-1





def read_int():

    return int(readline())





def read_int_n():

    return list(map(int, readline().split()))





def read_float():

    return float(readline())





def read_float_n():

    return list(map(float, readline().split()))





def read_str():

    return readline().strip()





def read_str_n():

    return readline().strip().split()





def error_print(*args):

    print(*args, file=sys.stderr)





def mt(f):

    import time



    def wrap(*args, **kwargs):

        s = time.perf_counter()

        ret = f(*args, **kwargs)

        e = time.perf_counter()



        error_print(e - s, 'sec')

        return ret



    return wrap





@mt

def slv(S, X, Y):

    n = 0

    m = []

    for c in S:

        if c == 'T':

            m.append(n)

            n = 0

        else:

            n += 1

    else:

        m.append(n)



    X -= m.pop(0)

    ym = m[::2]

    xm = m[1::2]



    memo = {0}

    for dx in xm:

        nm = set()

        for x in memo:

            nm.add(x+dx)

            nm.add(x-dx)

        memo = nm

    if X not in memo:

        return 'No'



    memo = {0}

    for dy in ym:

        nm = set()

        for y in memo:

            nm.add(y+dy)

            nm.add(y-dy)

        memo = nm

    if Y not in memo:

        return 'No'



    return 'Yes'









def main():

    S = read_str()

    X, Y = read_int_n()

    print(slv(S, X, Y))





if __name__ == '__main__':

    main()

# -*- coding: utf-8 -*-
import bisect
import heapq
import math
import random
import sys
from collections import Counter, defaultdict
from decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal
from functools import lru_cache, reduce
from itertools import combinations, combinations_with_replacement, product, permutations
from operator import add, mul

sys.setrecursionlimit(10000)


def read_int():
    return int(input())


def read_int_n():
    return list(map(int, input().split()))


def read_float():
    return float(input())


def read_float_n():
    return list(map(float, input().split()))


def read_str():
    return input()


def read_str_n():
    return list(map(str, input().split()))


def error_print(*args):
    print(*args, file=sys.stderr)


def mt(f):
    import time

    def wrap(*args, **kwargs):
        s = time.time()
        ret = f(*args, **kwargs)
        e = time.time()
        error_print(e - s, "sec")
        return ret

    return wrap


move = None
tx = None
ty = None


@mt
def slv(S, x, y):
    tx = x
    ty = y
    move = list(map(lambda x: len(x), S.split("T")))
    xm = [move[0]]
    for i in range(2, len(move), 2):
        xm_ = []
        for x in xm:
            xm_.append(x + move[i])
            xm_.append(x - move[i])
        xm = set(xm_)
    ym = [0]
    for i in range(1, len(move), 2):
        ym_ = []
        for y in ym:
            ym_.append(y + move[i])
            ym_.append(y - move[i])
        ym = set(ym_)
    return "Yes" if tx in xm and ty in ym else "No"


def main():
    S = read_str().strip()
    x, y = read_int_n()
    print(slv(S, x, y))


if __name__ == "__main__":
    main()

# -*- coding: utf-8 -*-
import bisect
import heapq
import math
import random
from collections import Counter, defaultdict, deque
from decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal
from fractions import Fraction
from functools import lru_cache, reduce
from itertools import (
    combinations,
    combinations_with_replacement,
    product,
    permutations,
    accumulate,
)
from operator import add, mul, sub, itemgetter, attrgetter
import sys

# sys.setrecursionlimit(10**6)
# readline = sys.stdin.buffer.readline
readline = sys.stdin.readline
INF = 2**62 - 1


def read_int():
    return int(readline())


def read_int_n():
    return list(map(int, readline().split()))


def read_float():
    return float(readline())


def read_float_n():
    return list(map(float, readline().split()))


def read_str():
    return readline().strip()


def read_str_n():
    return readline().strip().split()


def error_print(*args):
    print(*args, file=sys.stderr)


def mt(f):
    import time

    def wrap(*args, **kwargs):
        s = time.perf_counter()
        ret = f(*args, **kwargs)
        e = time.perf_counter()
        error_print(e - s, "sec")
        return ret

    return wrap


@mt
def slv(S, X, Y):
    n = 0
    m = []
    for c in S:
        if c == "T":
            m.append(n)
            n = 0
        else:
            n += 1
    else:
        m.append(n)
    X -= m.pop(0)
    ym = m[::2]
    xm = m[1::2]
    memo = {0}
    for dx in xm:
        nm = set()
        for x in memo:
            nm.add(x + dx)
            nm.add(x - dx)
        memo = nm
    if X not in memo:
        return "No"
    memo = {0}
    for dy in ym:
        nm = set()
        for y in memo:
            nm.add(y + dy)
            nm.add(y - dy)
        memo = nm
    if Y not in memo:
        return "No"
    return "Yes"


def main():
    S = read_str()
    X, Y = read_int_n()
    print(slv(S, X, Y))


if __name__ == "__main__":
    main()

+from collections import Counter, defaultdict, deque +from decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal +from fractions import Fraction +from functools import lru_cache, reduce +from itertools import ( +    combinations, +    combinations_with_replacement, +    product, +    permutations, +    accumulate, +) +from operator import add, mul, sub, itemgetter, attrgetter -from collections import Counter, defaultdict -from decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal -from functools import lru_cache, reduce -from itertools import combinations, combinations_with_replacement, product, permutations -from operator import add, mul -sys.setrecursionlimit(10000) +# sys.setrecursionlimit(10**6) +# readline = sys.stdin.buffer.readline +readline = sys.stdin.readline +INF = 2**62 - 1 -    return int(input()) +    return int(readline()) -    return list(map(int, input().split())) +    return list(map(int, readline().split())) -    return float(input()) +    return float(readline()) -    return list(map(float, input().split())) +    return list(map(float, readline().split())) -    return input() +    return readline().strip() -    return list(map(str, input().split())) +    return readline().strip().split() -        s = time.time() +        s = time.perf_counter() -        e = time.time() +        e = time.perf_counter() -move = None -tx = None -ty = None - - -def slv(S, x, y): -    tx = x -    ty = y -    move = list(map(lambda x: len(x), S.split("T"))) -    xm = [move[0]] -    for i in range(2, len(move), 2): -        xm_ = [] -        for x in xm: -            xm_.append(x + move[i]) -            xm_.append(x - move[i]) -        xm = set(xm_) -    ym = [0] -    for i in range(1, len(move), 2): -        ym_ = [] -        for y in ym: -            ym_.append(y + move[i]) -            ym_.append(y - move[i]) -        ym = set(ym_) -    return "Yes" if tx in xm and ty in ym else "No" +def slv(S, X, Y): +    n = 0 +    m = [] +    for c in S: +        if c == "T": +            m.append(n) +            n = 0 +        else: +            n += 1 +    else: +        m.append(n) +    X -= m.pop(0) +    ym = m[::2] +    xm = m[1::2] +    memo = {0} +    for dx in xm: +        nm = set() +        for x in memo: +            nm.add(x + dx) +            nm.add(x - dx) +        memo = nm +    if X not in memo: +        return "No" +    memo = {0} +    for dy in ym: +        nm = set() +        for y in memo: +            nm.add(y + dy) +            nm.add(y - dy) +        memo = nm +    if Y not in memo: +        return "No" +    return "Yes" -    S = read_str().strip() -    x, y = read_int_n() -    print(slv(S, x, y)) +    S = read_str() +    X, Y = read_int_n() +    print(slv(S, X, Y))