Under construction

Still being built. Things may change

Railway Trip 3

Time limit2sMemory limit2048 MB

Summary
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.

Examples3

  1. Example 1

    Input
    3 5
    2 1
    
    Expected output
    8
    
  2. Example 2

    Input
    3 2
    2 1
    
    Expected output
    4
    
  3. Example 3

    Input
    3 3
    5 5
    
    Expected output
    15