program main
  implicit none

  character(8000) :: s
  integer :: x, y
  integer :: lenseg(8000)

  read(*, *) s
  read(*, *) x, y

  call set_of_f(s, lenseg)
  if (possible(lenseg, x, .true.) .and. possible(lenseg, y, .false.)) then
    write(*, "(A)") "Yes"
  else
    write(*, "(A)") "No"
  end if

  contains

  pure subroutine set_of_f(s, lenseg)
    implicit none
    character(8000), intent(in) :: s
    integer, intent(out) :: lenseg(8000)
    integer :: ic, iseg

    lenseg(:) = 0
    iseg = 1
    do ic = 1, len(trim(s))
      if (s(ic:ic) == "F") then
        lenseg(iseg) = lenseg(iseg) + 1
      else
        iseg = iseg + 1
        lenseg(iseg) = 0
      end if
    end do
  end subroutine set_of_f

  function possible(lenseg, dest, is_x)
    implicit none
    integer, intent(in) :: lenseg(8000), dest
    logical, intent(in) :: is_x

    logical :: possible
    logical :: grid(-8000:8000), grid_next(-8000:8000)
    integer :: i, j, st

    grid(:) = .false.
    grid_next(:) = .false.

    if (is_x) then
      grid(lenseg(1)) = .true.
      st = 3
    else
      grid(0) = .true.
      st = 2
    end if

    do i = st, 8000, 2
      grid_next(:) = .false.
      do j = -8000, 8000
        if (grid(j)) then
          grid_next(j - lenseg(i)) = .true.
          grid_next(j + lenseg(i)) = .true.
        end if
      end do
      grid(:) = grid_next(:)
    end do

    possible = grid(dest)
  end function possible

end
