fun main(arg: Array<String>) {
    val S = next()
    val A = S.split("T").map { it.length }.toIntArray()
    val (X, Y) = listOfInt()
    val xy = Array(2) { mutableSetOf<Int>() }
    xy[0].add(0); xy[1].add(0)
    for ((index, dis) in A.withIndex()) {
        val p = mutableSetOf<Int>()
        if (index % 2 == 0) { //x
            if (index == 0) p.add(dis)
            else
            for (d in xy[0]) {
                p.add(d + dis)
                p.add(d - dis)
            }
            xy[0] = p
        } else { //y
            for (d in xy[1]) {
                p.add(d + dis)
                p.add(d - dis)
            }
            xy[1] = p
        }
    }
    val ans = if (xy[0].contains(X) && xy[1].contains(Y)) "Yes" else "No"
    println(ans)
//System.err.println("x\n${xy[0].sorted().joinToString("\n")}")
//System.err.println("y\n${xy[1].sorted().joinToString("\n")}")
}

fun next() = readLine()!!
fun nextInt() = next().toInt()
fun listOfString() = next().split(" ")
fun listOfInt() = listOfString().map { Integer.parseInt(it) }

