static void dfs ( int now , boolean te , boolean mae , boolean ato ) {
  if ( now == w ) {
    if ( mae ) {
      dp [ i ] [ j ] += dp [ i - 1 ] [ j - 1 ] ;
      dp [ i ] [ j ] %= mod ;
    }
    else if ( ato ) {
      dp [ i ] [ j ] += dp [ i - 1 ] [ j + 1 ] ;
      dp [ i ] [ j ] %= mod ;
    }
    else {
      dp [ i ] [ j ] += dp [ i - 1 ] [ j ] ;
      dp [ i ] [ j ] %= mod ;
    }
    return ;
  }
  if ( te ) {
    dfs ( now + 1 , false , mae , ato ) ;
  }
  else if ( now == j - 1 ) {
    dfs ( now + 1 , true , true , false ) ;
    dfs ( now + 1 , false , mae , ato ) ;
  }
  else if ( now == j ) {
    dfs ( now + 1 , true , mae , true ) ;
    dfs ( now + 1 , false , mae , ato ) ;
  }
  else {
    dfs ( now + 1 , true , mae , ato ) ;
    dfs ( now + 1 , false , mae , ato ) ;
  }
}

static void dfs ( int now , boolean te , boolean mae , boolean ato ) { if ( now == w ) { if ( mae ) { dp [ i ] [ j ] += dp [ i - 1 ] [ j - 1 ] ; dp [ i ] [ j ] %= mod ; } else if ( ato ) { dp [ i ] [ j ] += dp [ i - 1 ] [ j + 1 ] ; dp [ i ] [ j ] %= mod ; } else { dp [ i ] [ j ] += dp [ i - 1 ] [ j ] ; dp [ i ] [ j ] %= mod ; } return ; } if ( te ) { dfs ( now + 1 , false , mae , ato ) ; } else if ( now == j - 1 ) { dfs ( now + 1 , true , true , false ) ; dfs ( now + 1 , false , mae , ato ) ; } else if ( now == j ) { dfs ( now + 1 , true , mae , true ) ; dfs ( now + 1 , false , mae , ato ) ; } else { dfs ( now + 1 , true , mae , ato ) ; dfs ( now + 1 , false , mae , ato ) ; } }
(method_declaration (modifiers) type: (void_type) name: (identifier) parameters: (formal_parameters (formal_parameter type: (integral_type) name: (identifier)) (formal_parameter type: (boolean_type) name: (identifier)) (formal_parameter type: (boolean_type) name: (identifier)) (formal_parameter type: (boolean_type) name: (identifier))) body: (block (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (identifier))) consequence: (block (if_statement condition: (parenthesized_expression (identifier)) consequence: (block (expression_statement (assignment_expression left: (array_access array: (array_access array: (identifier) index: (identifier)) index: (identifier)) right: (array_access array: (array_access array: (identifier) index: (binary_expression left: (identifier) right: (decimal_integer_literal))) index: (binary_expression left: (identifier) right: (decimal_integer_literal))))) (expression_statement (assignment_expression left: (array_access array: (array_access array: (identifier) index: (identifier)) index: (identifier)) right: (identifier)))) alternative: (if_statement condition: (parenthesized_expression (identifier)) consequence: (block (expression_statement (assignment_expression left: (array_access array: (array_access array: (identifier) index: (identifier)) index: (identifier)) right: (array_access array: (array_access array: (identifier) index: (binary_expression left: (identifier) right: (decimal_integer_literal))) index: (binary_expression left: (identifier) right: (decimal_integer_literal))))) (expression_statement (assignment_expression left: (array_access array: (array_access array: (identifier) index: (identifier)) index: (identifier)) right: (identifier)))) alternative: (block (expression_statement (assignment_expression left: (array_access array: (array_access array: (identifier) index: (identifier)) index: (identifier)) right: (array_access array: (array_access array: (identifier) index: (binary_expression left: (identifier) right: (decimal_integer_literal))) index: (identifier)))) (expression_statement (assignment_expression left: (array_access array: (array_access array: (identifier) index: (identifier)) index: (identifier)) right: (identifier)))))) (return_statement))) (if_statement condition: (parenthesized_expression (identifier)) consequence: (block (expression_statement (method_invocation name: (identifier) arguments: (argument_list (binary_expression left: (identifier) right: (decimal_integer_literal)) (false) (identifier) (identifier))))) alternative: (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (binary_expression left: (identifier) right: (decimal_integer_literal)))) consequence: (block (expression_statement (method_invocation name: (identifier) arguments: (argument_list (binary_expression left: (identifier) right: (decimal_integer_literal)) (true) (true) (false)))) (expression_statement (method_invocation name: (identifier) arguments: (argument_list (binary_expression left: (identifier) right: (decimal_integer_literal)) (false) (identifier) (identifier))))) alternative: (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (identifier))) consequence: (block (expression_statement (method_invocation name: (identifier) arguments: (argument_list (binary_expression left: (identifier) right: (decimal_integer_literal)) (true) (identifier) (true)))) (expression_statement (method_invocation name: (identifier) arguments: (argument_list (binary_expression left: (identifier) right: (decimal_integer_literal)) (false) (identifier) (identifier))))) alternative: (block (expression_statement (method_invocation name: (identifier) arguments: (argument_list (binary_expression left: (identifier) right: (decimal_integer_literal)) (true) (identifier) (identifier)))) (expression_statement (method_invocation name: (identifier) arguments: (argument_list (binary_expression left: (identifier) right: (decimal_integer_literal)) (false) (identifier) (identifier))))))))))