fun main(args: Array<String>) {
    val s = readLine()!!
    val (xt, yt) = readLine()!!.split(' ').map { it.toInt() }

    val dx = mutableListOf<Int>()
    val dy = mutableListOf<Int>()
    s.split('T').forEachIndexed { i, sub ->
        if (i % 2 == 0) dx.add(sub.length) else dy.add(sub.length)
    }

    var xs = setOf(dx.first())
    var ys = setOf(0)

    for (d in dx.slice(1 until dx.size)) {
        xs = xs.flatMap { listOf(it - d, it + d) }.toSet()
    }

    for (d in dy) {
        ys = ys.flatMap { listOf(it - d, it + d) }.toSet()
    }

    println(if (xt in xs && yt in ys) "Yes" else "No")
}
