package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

func getScanner(fp *os.File) *bufio.Scanner {
	scanner := bufio.NewScanner(fp)
	scanner.Split(bufio.ScanWords)
	scanner.Buffer(make([]byte, 500001), 500000)
	return scanner
}

func getNextString(scanner *bufio.Scanner) string {
	scanner.Scan()
	return scanner.Text()
}

func getNextInt(scanner *bufio.Scanner) int {
	i, _ := strconv.Atoi(getNextString(scanner))
	return i
}

func getNextInt64(scanner *bufio.Scanner) int64 {
	i, _ := strconv.ParseInt(getNextString(scanner), 10, 64)
	return i
}

func main() {
	fp := os.Stdin
	if len(os.Args) > 1 {
		fp, _ = os.Open(os.Args[1])
	}

	scanner := getScanner(fp)
	writer := bufio.NewWriter(os.Stdout)

	s := getNextString(scanner)
	x := getNextInt(scanner)
	y := getNextInt(scanner)

	ans := solve(s, x, y)
	fmt.Fprintln(writer, ans)

	writer.Flush()
}

func solve(s string, x, y int) string {
	ans := "No"
	n := len(s)
	forwards := make([]int, n+1)
	f := 0
	for i := 0; i < n; i++ {
		if s[i] == 'F' {
			forwards[f]++
			continue
		}
		f++
	}
	imx := IntMap{}
	imy := IntMap{}
	imx.set(forwards[0], 1)
	imy.set(0, 1)
	for i := 1; i <= f; i++ {
		im := IntMap{}
		if i%2 == 0 {
			for v := range imx {
				im.set(v+forwards[i], 1)
				im.set(v-forwards[i], 1)
			}
			imx = im
			continue
		}
		for v := range imy {
			im.set(v+forwards[i], 1)
			im.set(v-forwards[i], 1)
		}
		imy = im
	}
	if imx.get(x) == 1 && imy.get(y) == 1 {
		ans = "Yes"
	}

	return ans
}

type Robot struct {
	x, y, d int
}

// IntMap ...
type IntMap map[int]int

func (m IntMap) get(key int) int {
	if _, ok := m[key]; ok {
		return m[key]
	}
	return 0
}

func (m IntMap) set(key, n int) {
	if _, ok := m[key]; ok == false {
		m[key] = 0
	}
	m[key] = n
}

func (m IntMap) increment(key int) {
	if _, ok := m[key]; ok == false {
		m[key] = 0
	}
	m[key]++
}

// IntMapMap ...
type IntMapMap map[int]IntMap

func (m IntMapMap) get(key1, key2 int) int {
	if _, ok := m[key1][key2]; ok {
		return m[key1][key2]
	}
	return 0
}

func (m IntMapMap) set(key1, key2, n int) {
	if _, ok := m[key1]; ok == false {
		m[key1] = make(IntMap, 0)
	}
	m[key1].set(key2, n)
}

func (m IntMapMap) increment(key1, key2 int) {
	if _, ok := m[key1]; ok == false {
		m[key1] = make(IntMap, 0)
	}
	m[key1].increment(key2)
}

func solve2(s string, x, y int) string {
	imm := IntMapMap{}

	queue := make([]Robot, 0)
	queue = append(queue, Robot{
		x: 0,
		y: 0,
		d: 0,
	})
	imm.set(0, 0, 1)

	n := len(s)

	for i := 0; i < n; i++ {
		lenq := len(queue)
		for ii := 0; ii < lenq; ii++ {
			imm.set(queue[ii].x, queue[ii].y, 0)
		}
		for ii := 0; ii < lenq; ii++ {
			qx := queue[ii].x
			qy := queue[ii].y
			qd := queue[ii].d
			if s[i] == 'T' {
				for t := 1; t <= 3; t += 2 {
					d := (qd + t) % 4
					if (imm.get(qx, qy) & (2 << uint(d))) == 0 {
						queue = append(queue, Robot{
							x: qx,
							y: qy,
							d: d,
						})
						imm.set(qx, qy, imm.get(qx, qy)|2<<uint(d))
					}
				}
				continue
			}
			switch qd {
			case 0:
				qx++
			case 1:
				qy--
			case 2:
				qx--
			case 3:
				qy++
			}
			if (imm.get(qx, qy) & 2 << uint(qd)) == 0 {
				queue = append(queue, Robot{
					x: qx,
					y: qy,
					d: qd,
				})
				imm.set(qx, qy, imm.get(qx, qy)|2<<uint(qd))
			}
		}
		queue = queue[lenq:]
	}

	ans := "No"
	l := len(queue)
	for i := 0; i < l; i++ {
		if queue[i].x == x && queue[i].y == y {
			ans = "Yes"
			break
		}
	}
	return ans
}


Measured memory_bytes: 7732