ENG  RUSTimus Online Judge
Online Judge
Problems
Authors
Online contests
About Online Judge
Frequently asked questions
Site news
Webboard
Links
Problem set
Submit solution
Judge status
Guide
Register
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules

УрКОП 2020

About     Problems     Submit solution     Judge status     Standings
Contest is over

F. Golden Apples

Time limit: 1.0 second
Memory limit: 256 MB
Recently the fruit market started testing a new price policy. After buying an apple from a merchant, the price for that merchant’s next apples is increased by 1.
Today Vasya and Petya are the only merchants selling apples, they are selling their first apple for prices a and b rubles respectively. Due to the constant supply, the amount of apples for sale is virtually unlimited.
After finding out about the new price policy, Masha went to the market early in the morning to buy N apples. She is the first in the queue, and she is wondering what’s the minimal amount of rubles required to buy the necessary number of apples.

Input

The first line contains one integer N (1 ≤ N ≤ 109) — the number of apples that Masha is going to buy.
The second line contains one integer a (1 ≤ a ≤ 109) — the price of Vasya’s first apple.
The third line contains one integer b (1 ≤ b ≤ 109) — the price of Petya’s first apple.

Output

Output one integer — the minimal amount of rubles that Masha could spend on N apples.

Samples

inputoutput
5
4
7
29
6
4
7
37
100
1
1000
5050
Problem Author: Valentin Zuev, prepared by Daniil Zheludkov
Problem Source: Ural School Programming Contest 2020