100 atcoder#ABC044A. [ABC044A] 高橋君とホテルイージー

[ABC044A] 高橋君とホテルイージー

Score : 100100 points

Problem Statement

There is a hotel with the following accommodation fee:

  • XX yen (the currency of Japan) per night, for the first KK nights
  • YY yen per night, for the (K+1)(K+1)-th and subsequent nights

Tak is staying at this hotel for NN consecutive nights. Find his total accommodation fee.

Constraints

  • 1N,K100001 \leq N, K \leq 10000
  • 1Y<X100001 \leq Y < X \leq 10000
  • N,K,X,YN,\,K,\,X,\,Y are integers.

Input

The input is given from Standard Input in the following format:

NN

KK

XX

YY

Output

Print Tak's total accommodation fee.

5
3
10000
9000
48000

The accommodation fee is as follows:

  • 1000010000 yen for the 11-st night
  • 1000010000 yen for the 22-nd night
  • 1000010000 yen for the 33-rd night
  • 90009000 yen for the 44-th night
  • 90009000 yen for the 55-th night

Thus, the total is 4800048000 yen.

2
3
10000
9000
20000