题目描述
Problem Description
There are $R$ red boxes and $B$ blue boxes, along with $R$ red balls and $B$ blue balls. Each box can only hold one ball, and each ball must be placed in a box.
- If a red ball is placed in a red box, the score is $C$.
- If a blue ball is placed in a blue box, the score is $D$.
- If a red ball is placed in a blue box, the score is $E$.
- If a blue ball is placed in a red box, the score is also $E$.
Given $R, B, C, D, E$, how should the balls be placed in the boxes to maximize the total score? Output the maximum total score.
Input Format
The input consists of a single line with five integers: $R, B, C, D, E$.
Output Format
Output a single integer representing the maximum total score.
Sample Input and Output
Sample Input #1
2 3 100 400 200
Sample Output #1
1400
Sample Input #2
2 3 100 400 300
Sample Output #2
1600
Notes
Data Range
For all data, $1 \le R \le 100$, $1 \le B \le 100$, $-1000 \le C, D, E \le 1000$.
输入格式
见题面 Input 部分
输出格式
见题面 Output 部分
样例输入
2 3 100 400 200
样例输出
1400