public static void main ( String [ ] args ) throws IOException {
  FastScanner fs = new FastScanner ( ) ;
  PrintWriter out = new PrintWriter ( System . out ) ;
  int tt = 1 ;
  while ( tt -- > 0 ) {
    int m = fs . nextInt ( ) , r = fs . nextInt ( ) ;
    double dist = 0 ;
    double l = Math . sqrt ( 2 ) * r ;
    for ( int i = 1 ;
    i <= m ;
    i ++ ) {
      dist += 2 * r ;
      if ( i > 1 ) {
        dist += 2 * r + l ;
        dist += ( i - 2 ) * r + ( i - 2 ) * 2 * l + ( double ) ( i - 2 ) * ( i - 2 ) * r ;
      }
      if ( i < m ) {
        dist += 2 * r + l ;
        dist += ( m - i - 1 ) * r + ( m - i - 1 ) * 2 * l + ( double ) ( m - i - 1 ) * ( m - i - 1 ) * r ;
      }
    }
    double avg = dist / ( ( double ) m * m ) ;
    out . println ( avg ) ;
  }
  out . close ( ) ;
}

public static void main ( String [ ] args ) throws IOException { FastScanner fs = new FastScanner ( ) ; PrintWriter out = new PrintWriter ( System . out ) ; int tt = 1 ; while ( tt -- > 0 ) { int m = fs . nextInt ( ) , r = fs . nextInt ( ) ; double dist = 0 ; double l = Math . sqrt ( 2 ) * r ; for ( int i = 1 ; i <= m ; i ++ ) { dist += 2 * r ; if ( i > 1 ) { dist += 2 * r + l ; dist += ( i - 2 ) * r + ( i - 2 ) * 2 * l + ( double ) ( i - 2 ) * ( i - 2 ) * r ; } if ( i < m ) { dist += 2 * r + l ; dist += ( m - i - 1 ) * r + ( m - i - 1 ) * 2 * l + ( double ) ( m - i - 1 ) * ( m - i - 1 ) * r ; } } double avg = dist / ( ( double ) m * m ) ; out . println ( avg ) ; } out . close ( ) ; }
(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)))) (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: (integral_type) declarator: (variable_declarator name: (identifier) value: (decimal_integer_literal))) (while_statement condition: (parenthesized_expression (binary_expression left: (update_expression (identifier)) right: (decimal_integer_literal))) body: (block (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: (floating_point_type) declarator: (variable_declarator name: (identifier) value: (decimal_integer_literal))) (local_variable_declaration type: (floating_point_type) declarator: (variable_declarator name: (identifier) value: (binary_expression left: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (decimal_integer_literal))) right: (identifier)))) (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 (expression_statement (assignment_expression left: (identifier) right: (binary_expression left: (decimal_integer_literal) right: (identifier)))) (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (decimal_integer_literal))) consequence: (block (expression_statement (assignment_expression left: (identifier) right: (binary_expression left: (binary_expression left: (decimal_integer_literal) right: (identifier)) right: (identifier)))) (expression_statement (assignment_expression left: (identifier) right: (binary_expression left: (binary_expression left: (binary_expression left: (parenthesized_expression (binary_expression left: (identifier) right: (decimal_integer_literal))) right: (identifier)) right: (binary_expression left: (binary_expression left: (parenthesized_expression (binary_expression left: (identifier) right: (decimal_integer_literal))) right: (decimal_integer_literal)) right: (identifier))) right: (binary_expression left: (binary_expression left: (cast_expression type: (floating_point_type) value: (parenthesized_expression (binary_expression left: (identifier) right: (decimal_integer_literal)))) right: (parenthesized_expression (binary_expression left: (identifier) right: (decimal_integer_literal)))) right: (identifier))))))) (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (identifier))) consequence: (block (expression_statement (assignment_expression left: (identifier) right: (binary_expression left: (binary_expression left: (decimal_integer_literal) right: (identifier)) right: (identifier)))) (expression_statement (assignment_expression left: (identifier) right: (binary_expression left: (binary_expression left: (binary_expression left: (parenthesized_expression (binary_expression left: (binary_expression left: (identifier) right: (identifier)) right: (decimal_integer_literal))) right: (identifier)) right: (binary_expression left: (binary_expression left: (parenthesized_expression (binary_expression left: (binary_expression left: (identifier) right: (identifier)) right: (decimal_integer_literal))) right: (decimal_integer_literal)) right: (identifier))) right: (binary_expression left: (binary_expression left: (cast_expression type: (floating_point_type) value: (parenthesized_expression (binary_expression left: (binary_expression left: (identifier) right: (identifier)) right: (decimal_integer_literal)))) right: (parenthesized_expression (binary_expression left: (binary_expression left: (identifier) right: (identifier)) right: (decimal_integer_literal)))) right: (identifier))))))))) (local_variable_declaration type: (floating_point_type) declarator: (variable_declarator name: (identifier) value: (binary_expression left: (identifier) right: (parenthesized_expression (binary_expression left: (cast_expression type: (floating_point_type) value: (identifier)) right: (identifier)))))) (expression_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier)))))) (expression_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)))))