Problem4523--购买鲜花

4523: 购买鲜花

[Creator : ]
Time Limit : 1.000 sec  Memory Limit : 128 MiB

Description

花店销售方式如下:

  • 单买一支花,价格为 lns="http://www.w3.org/1998/Math/MathML">a 元
  • 买一束花,价格为 lns="http://www.w3.org/1998/Math/MathML">b 元,一束花由 lns="http://www.w3.org/1998/Math/MathML">c 支花组合而成

布置会场需要用 lns="http://www.w3.org/1998/Math/MathML">n 支花,请问应该怎么买花费用最小?

Input

  • 第一行:一个整数 lns="http://www.w3.org/1998/Math/MathML">n
  • 第二行:一个整数 lns="http://www.w3.org/1998/Math/MathML">a
  • 第三行:两个整数 lns="http://www.w3.org/1998/Math/MathML">b 与 lns="http://www.w3.org/1998/Math/MathML">c

1≤n,a,b,c≤10000


Output

  • 单个整数,表示最小花费。

Sample Input Copy

3
3
7 3

Sample Output Copy

7

HINT

直接买一束花,7块钱就能满足3支花的数量

Source/Category