Railway Trip 3
Time limit2sMemory limit2048 MB
Given a trip length Q km, a rate A yen per km for the first P km, and B yen per km after that, the task is to print the total fare.
- Level
Easy1 of 10
- Topics
- Implementation, Math
- Solved
- No attempts yet
Problem
Bi-taro rides the JOI Railway for a trip. The JOI Railway charges A yen per km for the first P km, and B yen per km after that.
Print the fare for riding Q km.
Input
The input is given in the following format.
P Q
A B
Output
Print the fare for riding Q km, without the unit (yen).
Print nothing except the answer. Do not print prompts such as a request for input.
Constraints
1 ≦ P ≦ 100.1 ≦ Q ≦ 100.1 ≦ A ≦ 100.1 ≦ B ≦ 100.- All input values are integers.