public static void main ( String [ ] args ) throws Exception {
  BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ;
  String [ ] input = br . readLine ( ) . split ( " " ) ;
  String input2 = br . readLine ( ) ;
  long [ ] iceTeaList = new long [ 4 ] ;
  for ( int i = 0 ;
  i < ICE_TEA_COUNT ;
  i ++ ) {
    iceTeaList [ i ] = Integer . parseInt ( input [ i ] ) ;
  }
  int max = Integer . parseInt ( input2 ) ;
  long [ ] resultTea = new long [ 4 ] ;
  int multiple = 2 ;
  long beforeResult = 1 ;
  boolean continueFlag = false ;
  int point = 0 ;
  resultTea [ 0 ] = ( long ) ( max / SHORT_TEA ) ;
  for ( int i = 0 ;
  i < ICE_TEA_COUNT - 1 ;
  i ++ ) {
    if ( beforeResult == 0 ) {
      continueFlag = true ;
    }
    else if ( iceTeaList [ i + point ] * multiple > iceTeaList [ i + 1 ] ) {
      resultTea [ i + 1 ] = resultTea [ i + point ] / multiple ;
      resultTea [ i + point ] = resultTea [ i + point ] % multiple ;
      continueFlag = false ;
      point = 0 ;
      multiple = 2 ;
    }
    if ( continueFlag ) {
      point -= 1 ;
      multiple *= 2 ;
      if ( i + point >= 0 ) {
        beforeResult = ( long ) resultTea [ i + point ] ;
        i -= 1 ;
      }
      else {
        beforeResult = 1 ;
      }
      continue ;
    }
    beforeResult = resultTea [ i + 1 ] ;
  }
  System . out . println ( resultTea [ 0 ] * iceTeaList [ 0 ] + resultTea [ 1 ] * iceTeaList [ 1 ] + resultTea [ 2 ] * iceTeaList [ 2 ] + resultTea [ 3 ] * iceTeaList [ 3 ] ) ;
}

public static void main ( String [ ] args ) throws Exception { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; String [ ] input = br . readLine ( ) . split ( " ▁ " ) ; String input2 = br . readLine ( ) ; long [ ] iceTeaList = new long [ 4 ] ; for ( int i = 0 ; i < ICE_TEA_COUNT ; i ++ ) { iceTeaList [ i ] = Integer . parseInt ( input [ i ] ) ; } int max = Integer . parseInt ( input2 ) ; long [ ] resultTea = new long [ 4 ] ; int multiple = 2 ; long beforeResult = 1 ; boolean continueFlag = false ; int point = 0 ; resultTea [ 0 ] = ( long ) ( max / SHORT_TEA ) ; for ( int i = 0 ; i < ICE_TEA_COUNT - 1 ; i ++ ) { if ( beforeResult == 0 ) { continueFlag = true ; } else if ( iceTeaList [ i + point ] * multiple > iceTeaList [ i + 1 ] ) { resultTea [ i + 1 ] = resultTea [ i + point ] / multiple ; resultTea [ i + point ] = resultTea [ i + point ] % multiple ; continueFlag = false ; point = 0 ; multiple = 2 ; } if ( continueFlag ) { point -= 1 ; multiple *= 2 ; if ( i + point >= 0 ) { beforeResult = ( long ) resultTea [ i + point ] ; i -= 1 ; } else { beforeResult = 1 ; } continue ; } beforeResult = resultTea [ i + 1 ] ; } System . out . println ( resultTea [ 0 ] * iceTeaList [ 0 ] + resultTea [ 1 ] * iceTeaList [ 1 ] + resultTea [ 2 ] * iceTeaList [ 2 ] + resultTea [ 3 ] * iceTeaList [ 3 ] ) ; }
(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 (object_creation_expression type: (type_identifier) arguments: (argument_list (field_access object: (identifier) field: (identifier)))))))) (local_variable_declaration type: (array_type element: (type_identifier) dimensions: (dimensions)) declarator: (variable_declarator name: (identifier) value: (method_invocation object: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)) name: (identifier) arguments: (argument_list (string_literal))))) (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: (integral_type) dimensions: (dimensions)) declarator: (variable_declarator name: (identifier) value: (array_creation_expression type: (integral_type) dimensions: (dimensions_expr (decimal_integer_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 (expression_statement (assignment_expression left: (array_access array: (identifier) index: (identifier)) right: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (array_access array: (identifier) index: (identifier)))))))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier))))) (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))))) (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: (decimal_integer_literal))) (local_variable_declaration type: (boolean_type) declarator: (variable_declarator name: (identifier) value: (false))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (decimal_integer_literal))) (expression_statement (assignment_expression left: (array_access array: (identifier) index: (decimal_integer_literal)) right: (cast_expression type: (integral_type) value: (parenthesized_expression (binary_expression left: (identifier) 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: (binary_expression left: (identifier) right: (decimal_integer_literal))) update: (update_expression (identifier)) body: (block (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (decimal_integer_literal))) consequence: (block (expression_statement (assignment_expression left: (identifier) right: (true)))) alternative: (if_statement condition: (parenthesized_expression (binary_expression left: (binary_expression left: (array_access array: (identifier) index: (binary_expression left: (identifier) right: (identifier))) right: (identifier)) right: (array_access array: (identifier) index: (binary_expression left: (identifier) right: (decimal_integer_literal))))) consequence: (block (expression_statement (assignment_expression left: (array_access array: (identifier) index: (binary_expression left: (identifier) right: (decimal_integer_literal))) right: (binary_expression left: (array_access array: (identifier) index: (binary_expression left: (identifier) right: (identifier))) right: (identifier)))) (expression_statement (assignment_expression left: (array_access array: (identifier) index: (binary_expression left: (identifier) right: (identifier))) right: (binary_expression left: (array_access array: (identifier) index: (binary_expression left: (identifier) right: (identifier))) right: (identifier)))) (expression_statement (assignment_expression left: (identifier) right: (false))) (expression_statement (assignment_expression left: (identifier) right: (decimal_integer_literal))) (expression_statement (assignment_expression left: (identifier) right: (decimal_integer_literal)))))) (if_statement condition: (parenthesized_expression (identifier)) consequence: (block (expression_statement (assignment_expression left: (identifier) right: (decimal_integer_literal))) (expression_statement (assignment_expression left: (identifier) right: (decimal_integer_literal))) (if_statement condition: (parenthesized_expression (binary_expression left: (binary_expression left: (identifier) right: (identifier)) right: (decimal_integer_literal))) consequence: (block (expression_statement (assignment_expression left: (identifier) right: (cast_expression type: (integral_type) value: (array_access array: (identifier) index: (binary_expression left: (identifier) right: (identifier)))))) (expression_statement (assignment_expression left: (identifier) right: (decimal_integer_literal)))) alternative: (block (expression_statement (assignment_expression left: (identifier) right: (decimal_integer_literal))))) (continue_statement))) (expression_statement (assignment_expression left: (identifier) right: (array_access array: (identifier) index: (binary_expression left: (identifier) right: (decimal_integer_literal))))))) (expression_statement (method_invocation object: (field_access object: (identifier) field: (identifier)) name: (identifier) arguments: (argument_list (binary_expression left: (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: (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: (binary_expression left: (array_access array: (identifier) index: (decimal_integer_literal)) right: (array_access array: (identifier) index: (decimal_integer_literal)))))))))