public static void main ( String [ ] $ ) {
  Scanner scanner = new Scanner ( System . in ) ;
  long n = scanner . nextInt ( ) , h = scanner . nextInt ( ) , a = scanner . nextInt ( ) , b = scanner . nextInt ( ) , c = scanner . nextInt ( ) , d = scanner . nextInt ( ) , e = scanner . nextInt ( ) ;
  java . util . stream . LongStream . rangeClosed ( 0 , n ) . map ( x -> a * x + c * ( ( - Math . min ( 0 , h - 1 + b * x - e * ( n - x ) ) + d + e - 1 ) / ( d + e ) ) ) . min ( ) . ifPresent ( System . out :: println ) ;
}

public static void main ( String [ ] $ ) { Scanner scanner = new Scanner ( System . in ) ; long n = scanner . nextInt ( ) , h = scanner . nextInt ( ) , a = scanner . nextInt ( ) , b = scanner . nextInt ( ) , c = scanner . nextInt ( ) , d = scanner . nextInt ( ) , e = scanner . nextInt ( ) ; java . util . stream . LongStream . rangeClosed ( 0 , n ) . map ( x -> a * x + c * ( ( - Math . min ( 0 , h - 1 + b * x - e * ( n - x ) ) + d + e - 1 ) / ( d + e ) ) ) . min ( ) . ifPresent ( System . out :: println ) ; }
(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: (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))) 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))) 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))) declarator: (variable_declarator name: (identifier) value: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)))) (expression_statement (method_invocation object: (method_invocation object: (method_invocation object: (method_invocation object: (field_access object: (field_access object: (field_access object: (identifier) field: (identifier)) field: (identifier)) field: (identifier)) name: (identifier) arguments: (argument_list (decimal_integer_literal) (identifier))) name: (identifier) arguments: (argument_list (lambda_expression parameters: (identifier) body: (binary_expression left: (binary_expression left: (identifier) right: (identifier)) right: (binary_expression left: (identifier) right: (parenthesized_expression (binary_expression left: (parenthesized_expression (binary_expression left: (binary_expression left: (binary_expression left: (unary_expression operand: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (decimal_integer_literal) (binary_expression left: (binary_expression left: (binary_expression left: (identifier) right: (decimal_integer_literal)) right: (binary_expression left: (identifier) right: (identifier))) right: (binary_expression left: (identifier) right: (parenthesized_expression (binary_expression left: (identifier) right: (identifier)))))))) right: (identifier)) right: (identifier)) right: (decimal_integer_literal))) right: (parenthesized_expression (binary_expression left: (identifier) right: (identifier)))))))))) name: (identifier) arguments: (argument_list)) name: (identifier) arguments: (argument_list (method_reference (field_access object: (identifier) field: (identifier)) (identifier)))))))