public static void main ( String [ ] args ) throws IOException {
  Scanner sc = new Scanner ( System . in ) ;
  char [ ] s = sc . next ( ) . toCharArray ( ) ;
  int x = sc . nextInt ( ) , y = sc . nextInt ( ) ;
  int start = 0 , n = s . length ;
  while ( start < n && s [ start ] == 'F' ) start ++ ;
  ArrayList < Integer > hori = new ArrayList < > ( ) , vert = new ArrayList < > ( ) ;
  int parity = 0 ;
  int i = start ;
  while ( i < n ) {
    if ( s [ i ] == 'T' ) {
      parity = 1 - parity ;
      i ++ ;
    }
    else {
      int j = i + 1 ;
      while ( j < n && s [ j ] == 'F' ) j ++ ;
      if ( parity == 0 ) hori . add ( j - i ) ;
      else vert . add ( j - i ) ;
      i = j ;
    }
  }
  String ans = help ( x - start , hori ) && help ( y , vert ) ? "Yes" : "No" ;
  System . out . println ( ans ) ;
}

public static void main ( String [ ] args ) throws IOException { Scanner sc = new Scanner ( System . in ) ; char [ ] s = sc . next ( ) . toCharArray ( ) ; int x = sc . nextInt ( ) , y = sc . nextInt ( ) ; int start = 0 , n = s . length ; while ( start < n && s [ start ] == ' F ' ) start ++ ; ArrayList < Integer > hori = new ArrayList < > ( ) , vert = new ArrayList < > ( ) ; int parity = 0 ; int i = start ; while ( i < n ) { if ( s [ i ] == ' T ' ) { parity = 1 - parity ; i ++ ; } else { int j = i + 1 ; while ( j < n && s [ j ] == ' F ' ) j ++ ; if ( parity == 0 ) hori . add ( j - i ) ; else vert . add ( j - i ) ; i = j ; } } String ans = help ( x - start , hori ) && help ( y , vert ) ? " Yes " : " No " ; System . out . println ( ans ) ; }
(method_declaration (modifiers) type: (void_type) name: (identifier) parameters: (formal_parameters (formal_parameter type: (array_type element: (type_identifier) dimensions: (dimensions)) name: (identifier))) (throws (type_identifier)) body: (block (local_variable_declaration type: (type_identifier) declarator: (variable_declarator name: (identifier) value: (object_creation_expression type: (type_identifier) arguments: (argument_list (field_access object: (identifier) field: (identifier)))))) (local_variable_declaration type: (array_type element: (integral_type) dimensions: (dimensions)) declarator: (variable_declarator name: (identifier) value: (method_invocation object: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)) name: (identifier) arguments: (argument_list)))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list))) declarator: (variable_declarator name: (identifier) value: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (decimal_integer_literal)) declarator: (variable_declarator name: (identifier) value: (field_access object: (identifier) field: (identifier)))) (while_statement condition: (parenthesized_expression (binary_expression left: (binary_expression left: (identifier) right: (identifier)) right: (binary_expression left: (array_access array: (identifier) index: (identifier)) right: (character_literal)))) body: (expression_statement (update_expression (identifier)))) (local_variable_declaration type: (generic_type (type_identifier) (type_arguments (type_identifier))) declarator: (variable_declarator name: (identifier) value: (object_creation_expression type: (generic_type (type_identifier) (type_arguments)) arguments: (argument_list))) declarator: (variable_declarator name: (identifier) value: (object_creation_expression type: (generic_type (type_identifier) (type_arguments)) arguments: (argument_list)))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (decimal_integer_literal))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (identifier))) (while_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (identifier))) body: (block (if_statement condition: (parenthesized_expression (binary_expression left: (array_access array: (identifier) index: (identifier)) right: (character_literal))) consequence: (block (expression_statement (assignment_expression left: (identifier) right: (binary_expression left: (decimal_integer_literal) right: (identifier)))) (expression_statement (update_expression (identifier)))) alternative: (block (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (binary_expression left: (identifier) right: (decimal_integer_literal)))) (while_statement condition: (parenthesized_expression (binary_expression left: (binary_expression left: (identifier) right: (identifier)) right: (binary_expression left: (array_access array: (identifier) index: (identifier)) right: (character_literal)))) body: (expression_statement (update_expression (identifier)))) (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (decimal_integer_literal))) consequence: (expression_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (binary_expression left: (identifier) right: (identifier))))) alternative: (expression_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (binary_expression left: (identifier) right: (identifier)))))) (expression_statement (assignment_expression left: (identifier) right: (identifier))))))) (local_variable_declaration type: (type_identifier) declarator: (variable_declarator name: (identifier) value: (ternary_expression condition: (binary_expression left: (method_invocation name: (identifier) arguments: (argument_list (binary_expression left: (identifier) right: (identifier)) (identifier))) right: (method_invocation name: (identifier) arguments: (argument_list (identifier) (identifier)))) consequence: (string_literal) alternative: (string_literal)))) (expression_statement (method_invocation object: (field_access object: (identifier) field: (identifier)) name: (identifier) arguments: (argument_list (identifier))))))