s = input().strip()
x,y = map(int,input().split())
AX = []
AY = []
flag = 0
cnt = 0
for i in range(len(s)):
    if s[i]=="F":
        cnt += 1
    else:
        if flag==0:
            AX.append(cnt)
            cnt = 0
            flag = 1
        else:
            AY.append(cnt)
            cnt = 0
            flag = 0
if cnt>0 and flag==0:
    AX.append(cnt)
if cnt>0 and flag==1:
    AY.append(cnt)
dpX = [[0 for _ in range(2*abs(x)+1)] for _ in range(len(AX)+1)]
if s[0]=="F":
    dpX[1][abs(x)+AX[0]] = 1
    for i in range(2,len(AX)+1):
        for j in range(2*abs(x)+1):
            if 0<=j+AX[i-1]<=2*abs(x):
                dpX[i][j] = dpX[i][j+AX[i-1]]
                if 0<=j-AX[i-1]<=2*abs(x):
                    dpX[i][j] = dpX[i][j] or dpX[i-1][j-AX[i-1]]
            elif 0<=j-AX[i-1]<=2*abs(x):
                dpX[i][j] = dpX[i-1][j-AX[i-1]]
else:
    dpX[0][0] = 1
    for i in range(1,len(AX)+1):
        for j in range(2*abs(x)+1):
            if 0<=j+AX[i-1]<=2*abs(x):
                dpX[i][j] = dpX[i-1][j+AX[i-1]]
                if 0<=j-AX[i-1]<=2*abs(x):
                    dpX[i][j] = dpX[i][j] or dpX[i-1][j-AX[i-1]]
            elif 0<=j-AX[i-1]<=2*abs(x):
                dpX[i][j] = dpX[i-1][j-AX[i-1]]
dpY = [[0 for _ in range(2*abs(y)+1)] for _ in range(len(AY)+1)]
dpY[0][abs(y)] = 1
for i in range(1,len(AY)+1):
    for j in range(2*abs(y)+1):
        if 0<=j+AY[i-1]<=2*abs(y):
            dpY[i][j] = dpY[i-1][j+AY[i-1]]
            if 0<=j-AY[i-1]<=2*abs(y):
                dpY[i][j] = dpY[i][j] or dpY[i-1][j-AY[i-1]]
        elif 0<=j-AY[i-1]<=2*abs(y):
            dpY[i][j] = dpY[i][j] or dpY[i-1][j-AY[i-1]]
if dpX[len(AX)][abs(x)+x]==1 and dpY[len(AY)][abs(y)+y]==1:
    print("Yes")
else:
    print("No")

### FIXED CODE ###

s = input().strip()
x,y = map(int,input().split())
C = {}
cur = 0
cnt = 0
for i in range(len(s)):
    if s[i]=="F":
        cnt += 1
    else:
        C[cur] = cnt
        cur += 1
        cnt = 0
C[cur] = cnt
AX = []
AY = []
for a in C:
    if a>0 and a%2==0 and C[a]>0:
        AX.append(C[a])
    elif a%2==1 and C[a]>0:
        AY.append(C[a])
cntx = sum(AX)
dpx = [[0 for _ in range(2*cntx+1)] for _ in range(len(AX)+1)]
dpx[0][cntx] = 1
if cntx>0:
    dpx[1][cntx-AX[0]] = 1
    dpx[1][cntx+AX[0]] = 1
    for i in range(2,len(AX)+1):
        for j in range(-cntx,cntx+1):
            if -cntx<=j-AX[i-1]:
                dpx[i][j+cntx] = dpx[i-1][j-AX[i-1]+cntx]
                if j+AX[i-1]<=cntx:
                    dpx[i][j+cntx] = max(dpx[i][j+cntx],dpx[i-1][j+AX[i-1]+cntx])
            elif j+AX[i-1]<=cntx:
                dpx[i][j+cntx] = dpx[i-1][j+AX[i-1]+cntx]
cnty = sum(AY)
dpy = [[0 for _ in range(2*cnty+1)] for _ in range(len(AY)+1)]
dpy[0][cnty] = 1
if cnty>0:
    dpy[1][cnty-AY[0]] = 1
    dpy[1][cnty+AY[0]] = 1
    for i in range(2,len(AY)+1):
        for j in range(-cnty,cnty+1):
            if -cnty<=j-AY[i-1]:
                dpy[i][j+cnty] = dpy[i-1][j-AY[i-1]+cnty]
                if j+AY[i-1]<=cnty:
                    dpy[i][j+cnty] = max(dpy[i][j+cnty],dpy[i-1][j+AY[i-1]+cnty])
            elif j+AY[i-1]<=cnty:
                dpy[i][j+cnty] = dpy[i-1][j+AY[i-1]+cnty]
if C[0]-cntx<=x<=C[0]+cntx and dpx[len(AX)][x-C[0]+cntx]==1 and -cnty<=y<=cnty and dpy[len(AY)][y+cnty]==1:
    print("Yes")
else:
    print("No")