spent some time on an internship in MDCS. After earning enough money, he decided to go on a holiday somewhere far, far away. He enjoyed suntanning, drinking alcohol-free cocktails and going to concerts of popular local bands. While listening to "The White Buttons" and their hit song "Dacan the Baker", he met another robot for whom he was sure was the love of his life. Well, his summer, at least.
Anyway, was too shy to approach his potential soulmate, so he decided to write her a love letter. However, he stumbled upon a problem. Due to a terrorist threat, the Intergalactic Space Police was monitoring all letters sent in the area. Thus, decided to invent his own alphabet, for which he was sure his love would be able to decipher.
There are letters in 's alphabet, and he wants to represent each letter as a sequence of s and s, so that no letter's sequence is a prefix of another one's sequence. Since the Intergalactic Space Communications Service has lately introduced a tax for invented alphabets, must pay a certain amount of money for each bit in his alphabet's code. He is too lovestruck to think clearly, so he asked you for help.
Given the costs and for each and in 's alphabet, respectively, you should come up with a coding for the alphabet (with properties as above) with minimal total cost.
Input Specification
The first line of input contains integers:
- - the number of letters in the alphabet
- - cost of s
- - cost of s
Output Specification
Output a single number - the minimal cost of the whole alphabet.
Constraints
Sample Input
4 1 2
Sample Output
12
Explanation
The alphabet is 00
, 01
, 10
, 11
. So minimal total cost is .
Comments