P23716 [AtCoder] [ABC024A] Zoo
入门
题目描述

Problem Description

ABC Zoo is the most popular zoo in the Takahashi Kingdom.

The admission fee at ABC Zoo is set as follows:

  • Each child pays $A$ yen
  • Each adult pays $B$ yen
  • Groups with a total of $K$ or more people get a discount of $C$ yen per person

Now, a group consisting of $S$ children and $T$ adults is about to enter the zoo. Calculate the total admission fee this group must pay.

Input Format

The input is given from the standard input in the following format:

$A$ $B$ $C$ $K$ $S$ $T$

  • The first line contains four integers $A, B, C, K$ separated by spaces, representing the price settings for the admission fee. The meanings of these variables are the same as in the problem statement. Each variable satisfies the following constraints:
  • $0 ≦ C ≦ A ≦ B ≦ 1,000$
  • $0 ≦ K ≦ 100$
  • The second line contains two integers $S (0 ≦ S ≦ 100)$ and $T (0 ≦ T ≦ 100)$, representing the number of children and adults in the group, respectively.

Output Format

Output the total admission fee the group must pay in one line. End the output with a newline.

Sample Input and Output

Sample Input #1

100 200 50 20
40 10

Sample Output #1

3500

Sample Input #2

400 1000 400 21
10 10

Sample Output #2

14000

Sample Input #3

400 1000 400 20
10 10

Sample Output #3

6000

Notes/Hints

Sample Explanation 1

The group consists of 40 children and 10 adults. Since the total number of people is 20 or more, a discount of 50 yen per person is applied, totaling a discount of 2500 yen.

Sample Explanation 2

The total number of people in the group is not 21 or more, so no discount is applied.

输入格式

见题面 Input 部分

输出格式

见题面 Output 部分

样例输入
100 200 50 20 40 10
样例输出
3500