P27239 [AtCoder] Microwave
普及
题目描述

Problem Description

JOI is trying to warm up meat at temperature $ A $℃ to $ B $℃ using a microwave. The meat is frozen when its temperature is below $ 0 $℃, and unfrozen when its temperature is above $ 0 $℃. The state of the meat at exactly $ 0 $℃ can be either frozen or unfrozen.

JOI estimates the time required to heat the meat as follows:

  • When the meat is frozen and its temperature is below $ 0 $℃: It warms up by $ 1 $℃ in $ C $ seconds.
  • When the meat is frozen and its temperature is exactly $ 0 $℃: It takes $ D $ seconds to defrost the meat, making it unfrozen.
  • When the meat is unfrozen: It warms up by $ 1 $℃ in $ E $ seconds.

Determine how many seconds it takes to warm the meat to $ B $℃.


Input Format

The input consists of 5 lines, each containing one integer.

The first line contains the original temperature of the meat $ A $.
The second line contains the target temperature $ B $.
The third line contains the time $ C $ required to warm up frozen meat by $ 1 $℃.
The fourth line contains the time $ D $ required to defrost the meat.
The fifth line contains the time $ E $ required to warm up unfrozen meat by $ 1 $℃.

The original temperature $ A $ is between $ -100 $ and $ 100 $, the target temperature $ B $ is between $ 1 $ and $ 100 $, and $A \neq 0$ and $ A < B $.

Output Format

Output the number of seconds required to warm the meat to $ B $℃ in one line.


Sample Input and Output

Sample Input #1

-10
20
5
10
3

Sample Output #1

120

Sample Input #2

35
92
31
50
11

Sample Output #2

627

Notes/Hints

Sample Explanation 1

In the first sample input, the meat is originally at $ -10 $℃ and frozen. The time required is as follows:
- Warming from $ -10 $℃ to $ 0 $℃ takes $5 \times 10 = 50$ seconds.
- Defrosting the meat at $ 0 $℃ takes $ 10 $ seconds.
- Warming from $ 0 $℃ to $ 20 $℃ takes $3 \times 20 = 60$ seconds.
Thus, the total time required is $ 120 $ seconds.

Sample Explanation 2

In the second sample input, the meat is originally unfrozen. Therefore, the time required to warm the meat from $ 35 $℃ to $ 92 $℃ is $ 627 $ seconds.

输入格式

见题面 Input 部分

输出格式

见题面 Output 部分

样例输入
-10 20 5 10 3
样例输出
120