static long f ( long v , int floor ) {
  if ( floor == 1 ) {
    return ( v - 1 ) * ( m - 1 ) * 2 ;
  }
  if ( floor == m ) {
    return ( m - 1 ) + ( ( v - 1 ) * ( m - 1 ) * 2 ) ;
  }
  long ret = 0 ;
  long even = v / 2 ;
  long odd = v / 2 ;
  if ( v % 2 == 0 ) even -- ;
  long sumEven = even * ( m - floor ) * 2 ;
  long sumOdd = odd * ( floor - 1 ) * 2 ;
  sumOdd = sumOdd - ( floor - 1 ) ;
  ret = sumEven + sumOdd ;
  return ret ;
}

static long f ( long v , int floor ) { if ( floor == 1 ) { return ( v - 1 ) * ( m - 1 ) * 2 ; } if ( floor == m ) { return ( m - 1 ) + ( ( v - 1 ) * ( m - 1 ) * 2 ) ; } long ret = 0 ; long even = v / 2 ; long odd = v / 2 ; if ( v % 2 == 0 ) even -- ; long sumEven = even * ( m - floor ) * 2 ; long sumOdd = odd * ( floor - 1 ) * 2 ; sumOdd = sumOdd - ( floor - 1 ) ; ret = sumEven + sumOdd ; return ret ; }
(method_declaration (modifiers) type: (integral_type) name: (identifier) parameters: (formal_parameters (formal_parameter type: (integral_type) name: (identifier)) (formal_parameter type: (integral_type) name: (identifier))) body: (block (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (decimal_integer_literal))) consequence: (block (return_statement (binary_expression left: (binary_expression left: (parenthesized_expression (binary_expression left: (identifier) right: (decimal_integer_literal))) right: (parenthesized_expression (binary_expression left: (identifier) right: (decimal_integer_literal)))) right: (decimal_integer_literal))))) (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (identifier))) consequence: (block (return_statement (binary_expression left: (parenthesized_expression (binary_expression left: (identifier) right: (decimal_integer_literal))) right: (parenthesized_expression (binary_expression left: (binary_expression left: (parenthesized_expression (binary_expression left: (identifier) right: (decimal_integer_literal))) right: (parenthesized_expression (binary_expression left: (identifier) right: (decimal_integer_literal)))) right: (decimal_integer_literal))))))) (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: (binary_expression left: (identifier) right: (decimal_integer_literal)))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (binary_expression left: (identifier) right: (decimal_integer_literal)))) (if_statement condition: (parenthesized_expression (binary_expression left: (binary_expression left: (identifier) right: (decimal_integer_literal)) right: (decimal_integer_literal))) consequence: (expression_statement (update_expression (identifier)))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (binary_expression left: (binary_expression left: (identifier) right: (parenthesized_expression (binary_expression left: (identifier) right: (identifier)))) right: (decimal_integer_literal)))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (binary_expression left: (binary_expression left: (identifier) right: (parenthesized_expression (binary_expression left: (identifier) right: (decimal_integer_literal)))) right: (decimal_integer_literal)))) (expression_statement (assignment_expression left: (identifier) right: (binary_expression left: (identifier) right: (parenthesized_expression (binary_expression left: (identifier) right: (decimal_integer_literal)))))) (expression_statement (assignment_expression left: (identifier) right: (binary_expression left: (identifier) right: (identifier)))) (return_statement (identifier))))