public static void main ( String [ ] args ) {
  Scanner z = new Scanner ( System . in ) ;
  String line = z . nextLine ( ) ;
  String [ ] arrayOfNumberString = line . split ( " " ) ;
  int [ ] a = new int [ 4 ] ;
  a [ 0 ] = Integer . valueOf ( arrayOfNumberString [ 0 ] ) ;
  a [ 1 ] = Integer . valueOf ( arrayOfNumberString [ 1 ] ) ;
  a [ 2 ] = Integer . valueOf ( arrayOfNumberString [ 2 ] ) ;
  a [ 3 ] = Integer . valueOf ( arrayOfNumberString [ 3 ] ) ;
  int d = a [ 1 ] - a [ 0 ] ;
  if ( a [ 2 ] - a [ 1 ] == d && a [ 3 ] - a [ 2 ] == d ) System . out . println ( a [ 3 ] + d ) ;
  else if ( ( a [ 0 ] * a [ 2 ] == a [ 1 ] * a [ 1 ] ) && ( a [ 1 ] * a [ 3 ] == a [ 2 ] * a [ 2 ] ) && ( a [ 3 ] * a [ 3 ] % a [ 2 ] == 0 ) ) System . out . println ( a [ 3 ] * a [ 3 ] / a [ 2 ] ) ;
  else System . out . println ( 42 ) ;
}

public static void main ( String [ ] args ) { Scanner z = new Scanner ( System . in ) ; String line = z . nextLine ( ) ; String [ ] arrayOfNumberString = line . split ( " ▁ " ) ; int [ ] a = new int [ 4 ] ; a [ 0 ] = Integer . valueOf ( arrayOfNumberString [ 0 ] ) ; a [ 1 ] = Integer . valueOf ( arrayOfNumberString [ 1 ] ) ; a [ 2 ] = Integer . valueOf ( arrayOfNumberString [ 2 ] ) ; a [ 3 ] = Integer . valueOf ( arrayOfNumberString [ 3 ] ) ; int d = a [ 1 ] - a [ 0 ] ; if ( a [ 2 ] - a [ 1 ] == d && a [ 3 ] - a [ 2 ] == d ) System . out . println ( a [ 3 ] + d ) ; else if ( ( a [ 0 ] * a [ 2 ] == a [ 1 ] * a [ 1 ] ) && ( a [ 1 ] * a [ 3 ] == a [ 2 ] * a [ 2 ] ) && ( a [ 3 ] * a [ 3 ] % a [ 2 ] == 0 ) ) System . out . println ( a [ 3 ] * a [ 3 ] / a [ 2 ] ) ; else System . out . println ( 42 ) ; }
(method_declaration (modifiers) type: (void_type) name: (identifier) parameters: (formal_parameters (formal_parameter type: (array_type element: (type_identifier) dimensions: (dimensions)) name: (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: (type_identifier) declarator: (variable_declarator name: (identifier) value: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)))) (local_variable_declaration type: (array_type element: (type_identifier) dimensions: (dimensions)) declarator: (variable_declarator name: (identifier) value: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (string_literal))))) (local_variable_declaration type: (array_type element: (integral_type) dimensions: (dimensions)) declarator: (variable_declarator name: (identifier) value: (array_creation_expression type: (integral_type) dimensions: (dimensions_expr (decimal_integer_literal))))) (expression_statement (assignment_expression left: (array_access array: (identifier) index: (decimal_integer_literal)) right: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (array_access array: (identifier) index: (decimal_integer_literal)))))) (expression_statement (assignment_expression left: (array_access array: (identifier) index: (decimal_integer_literal)) right: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (array_access array: (identifier) index: (decimal_integer_literal)))))) (expression_statement (assignment_expression left: (array_access array: (identifier) index: (decimal_integer_literal)) right: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (array_access array: (identifier) index: (decimal_integer_literal)))))) (expression_statement (assignment_expression left: (array_access array: (identifier) index: (decimal_integer_literal)) right: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (array_access array: (identifier) index: (decimal_integer_literal)))))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (binary_expression left: (array_access array: (identifier) index: (decimal_integer_literal)) right: (array_access array: (identifier) index: (decimal_integer_literal))))) (if_statement condition: (parenthesized_expression (binary_expression left: (binary_expression left: (binary_expression left: (array_access array: (identifier) index: (decimal_integer_literal)) right: (array_access array: (identifier) index: (decimal_integer_literal))) right: (identifier)) right: (binary_expression left: (binary_expression left: (array_access array: (identifier) index: (decimal_integer_literal)) right: (array_access array: (identifier) index: (decimal_integer_literal))) right: (identifier)))) consequence: (expression_statement (method_invocation object: (field_access object: (identifier) field: (identifier)) name: (identifier) arguments: (argument_list (binary_expression left: (array_access array: (identifier) index: (decimal_integer_literal)) right: (identifier))))) alternative: (if_statement condition: (parenthesized_expression (binary_expression left: (binary_expression left: (parenthesized_expression (binary_expression left: (binary_expression left: (array_access array: (identifier) index: (decimal_integer_literal)) right: (array_access array: (identifier) index: (decimal_integer_literal))) right: (binary_expression left: (array_access array: (identifier) index: (decimal_integer_literal)) right: (array_access array: (identifier) index: (decimal_integer_literal))))) right: (parenthesized_expression (binary_expression left: (binary_expression left: (array_access array: (identifier) index: (decimal_integer_literal)) right: (array_access array: (identifier) index: (decimal_integer_literal))) right: (binary_expression left: (array_access array: (identifier) index: (decimal_integer_literal)) right: (array_access array: (identifier) index: (decimal_integer_literal)))))) right: (parenthesized_expression (binary_expression left: (binary_expression left: (binary_expression left: (array_access array: (identifier) index: (decimal_integer_literal)) right: (array_access array: (identifier) index: (decimal_integer_literal))) right: (array_access array: (identifier) index: (decimal_integer_literal))) right: (decimal_integer_literal))))) consequence: (expression_statement (method_invocation object: (field_access object: (identifier) field: (identifier)) name: (identifier) arguments: (argument_list (binary_expression left: (binary_expression left: (array_access array: (identifier) index: (decimal_integer_literal)) right: (array_access array: (identifier) index: (decimal_integer_literal))) right: (array_access array: (identifier) index: (decimal_integer_literal)))))) alternative: (expression_statement (method_invocation object: (field_access object: (identifier) field: (identifier)) name: (identifier) arguments: (argument_list (decimal_integer_literal))))))))