s = input().strip()
N = len(s)
x,y = map(int,input().split())
flag0 = 0
for i in range(N):
    if s[i]=="T":
        ind = i
        flag0 = 1
        break
if flag0==0:
    if y==0 and x==N:
        print("Yes")
    else:
        print("No")
else:
    C={"x":[],"y":[]}
    flag=0
    cnt = 0
    for i in range(ind+1,N):
        if s[i]!="T":
            cnt += 1
        else:
            if flag==0 and cnt>0:
                C["y"].append(cnt)
            elif flag==1 and cnt>0:
                C["x"].append(cnt)
            cnt = 0
            flag = 1-flag
    if flag==0:
        C["y"].append(cnt)
    else:
        C["x"].append(cnt)
    nx = len(C["x"])
    xlim = 0
    for i in range(nx):
        xlim += C["x"][i]
    ny = len(C["y"])
    ylim = 0
    for i in range(ny):
        ylim += C["y"][i]
    x = x-ind  #x>=-N
    if x<-xlim-1 or x>xlim+1 or y<-ylim-1 or y>ylim+1:
        print("No")
    else:
        dp1 = {(i,j):0 for i in range(nx+1) for j in range(-xlim,xlim+1)}
        dp1[(0,0)]=1
        for i in range(1,nx+1):
            for j in range(-xlim,xlim+1):
                dp1[(i,j)] = dp1[(i-1,j)]
                if j-C["x"][i-1]>=-xlim:
                    dp1[(i,j)] = dp1[(i,j)]|dp1[(i-1,j-C["x"][i-1])]
                if j+C["x"][i-1]<=xlim:
                    dp1[(i,j)] = dp1[(i,j)]|dp1[(i-1,j+C["x"][i-1])]
        dp0 = {(i,j):0 for i in range(ny+1) for j in range(-ylim,ylim+1)}
        dp0[(0,0)] = 1
        for i in range(1,ny+1):
            for j in range(-ylim,ylim+1):
                dp0[(i,j)] = dp0[(i-1,j)]
                if j-C["y"][i-1]>=-ylim:
                    dp0[(i,j)] = dp0[(i,j)]|dp0[(i-1,j-C["y"][i-1])]
                if j+C["y"][i-1]<=ylim:
                    dp0[(i,j)] = dp0[(i,j)]|dp0[(i-1,j+C["y"][i-1])]
        if dp1[(nx,x)]==1 and dp0[(ny,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")