Problem: zscoder wants to generate an input file for some programming competition problem.

His input is a string consisting of n letters 'a'. He is too lazy to write a generator so he will manually generate the input in a text editor.

Initially, the text editor is empty. It takes him x seconds to insert or delete a letter 'a' from the text file and y seconds to copy the contents of the entire text file, and duplicate it.

zscoder wants to find the minimum amount of time needed for him to create the input file of exactly n letters 'a'. Help him to determine the amount of time needed to generate the input.

Input

The only line contains three integers n, x and y (1 ≤ n ≤ 107, 1 ≤ x, y ≤ 109) — the number of letters 'a' in the input file and the parameters from the problem statement.

Output

Print the only integer t — the minimum amount of time needed to generate the input file.

Examples

Input

8 1 1


Output

4


Input

8 1 10


Output

8

Solution (in CPP):

Solution:
#include <bits/stdc++.h>
using namespace std;
inline long long in() {
  int32_t x;
  scanf("%d", &x);
  return x;
}
inline long long lin() {
  long long x;
  scanf("%lld", &x);
  return x;
}
char ch[4000010];
inline string get() {
  scanf("%s", ch);
  return string(ch);
}
inline void read(long long *a, long long n) {
  for (long long i = 0; i < n; i++) a[i] = in();
}
template <class blank>
inline void out(blank x) {
  cout << x << "\n";
  exit(0);
}
template <class blank, class blank2>
inline void smin(blank &a, blank2 b) {
  a = a <= b ? a : b;
}
template <class blank, class blank2>
inline void smax(blank &a, blank2 b) {
  a = a >= b ? a : b;
}
const long long maxn = 1e7 + 10;
const long long maxm = 4e6 + 10;
const long long maxlg = 20;
const long long base = 29;
const long long mod = 1e9 + 7;
const long long inf = 2e18 + 10;
const double eps = 1e-9;
long long dp[maxn];
int32_t main() {
  deque<pair<long long, long long> > q;
  long long n = in(), x = in(), y = in();
  memset(dp, 63, sizeof dp);
  dp[0] = 0;
  for (long long i = 0; i <= n; i++) {
    while (!q.empty() && q.front().second < i) q.pop_front();
    if (!q.empty()) dp[i] = min(dp[i], q.front().first - i * x);
    pair<long long, long long> add = {dp[i] + y + 2 * i * x, 2 * i};
    while (!q.empty() && q.back().first > add.first) q.pop_back();
    q.push_back(add);
    dp[i + 1] = dp[i] + x;
  }
  cout << dp[n] << "\n";
}