Problem2406--Apple

2406: Apple

[Creator : ]
Time Limit : 2.000 sec  Memory Limit : 1024 MB

Description

A fruit store sells apples.
You may perform the following operations as many times as you want in any order:

  • Buy one apple for X RMB(the currency in China).
  • Buy three apples for Y RMB.

How much RMB do you need to pay to obtain exactly N apples?

Input

Input is given from Standard Input in the following format

Output

Print the answer as an integer.

Sample Input Copy

10 25 10

Sample Output Copy

85

Source/Category