static double compute ( int at ) {
  if ( DP [ at ] != - 1 ) return DP [ at ] ;
  double ans = 0.0 ;
  for ( int i = 0 ;
  i < N ;
  i ++ ) {
    int cost = N ;
    int j = i ;
    while ( get ( at , j ) ) {
      j ++ ;
      cost -- ;
      if ( j == N ) j = 0 ;
    }
    ans += cost + compute ( at | ( 1 << j ) ) ;
  }
  ans /= N ;
  DP [ at ] = ans ;
  return ans ;
}

static double compute ( int at ) { if ( DP [ at ] != - 1 ) return DP [ at ] ; double ans = 0.0 ; for ( int i = 0 ; i < N ; i ++ ) { int cost = N ; int j = i ; while ( get ( at , j ) ) { j ++ ; cost -- ; if ( j == N ) j = 0 ; } ans += cost + compute ( at | ( 1 << j ) ) ; } ans /= N ; DP [ at ] = ans ; return ans ; }
(method_declaration (modifiers) type: (floating_point_type) name: (identifier) parameters: (formal_parameters (formal_parameter type: (integral_type) name: (identifier))) body: (block (if_statement condition: (parenthesized_expression (binary_expression left: (array_access array: (identifier) index: (identifier)) right: (unary_expression operand: (decimal_integer_literal)))) consequence: (return_statement (array_access array: (identifier) index: (identifier)))) (local_variable_declaration type: (floating_point_type) declarator: (variable_declarator name: (identifier) value: (decimal_floating_point_literal))) (for_statement init: (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (decimal_integer_literal))) condition: (binary_expression left: (identifier) right: (identifier)) update: (update_expression (identifier)) body: (block (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (identifier))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (identifier))) (while_statement condition: (parenthesized_expression (method_invocation name: (identifier) arguments: (argument_list (identifier) (identifier)))) body: (block (expression_statement (update_expression (identifier))) (expression_statement (update_expression (identifier))) (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (identifier))) consequence: (expression_statement (assignment_expression left: (identifier) right: (decimal_integer_literal)))))) (expression_statement (assignment_expression left: (identifier) right: (binary_expression left: (identifier) right: (method_invocation name: (identifier) arguments: (argument_list (binary_expression left: (identifier) right: (parenthesized_expression (binary_expression left: (decimal_integer_literal) right: (identifier))))))))))) (expression_statement (assignment_expression left: (identifier) right: (identifier))) (expression_statement (assignment_expression left: (array_access array: (identifier) index: (identifier)) right: (identifier))) (return_statement (identifier))))