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;
const int INF = 0x3f3f3f3f;
const long long LINF = 0x3f3f3f3f3f3f3f3fLL;
const double PI = acos(-1.0);
const double EPS = 1e-8;
const int MOD = 1e9 + 7;
long long qpow(long long x, long long n, long long mod = MOD) {
  long long res = 1;
  while (n) {
    if (n & 1) res = res * x % mod;
    x = x * x % mod;
    n >>= 1;
  }
  return res;
}
namespace Solver {
void InitOnce() { int t; }
int n, x, y;
const int LIMIT = 2e7;
long long dis[LIMIT + 5];
bool vis[LIMIT + 5];
priority_queue<pair<long long, int> > PQ;
void Read() {
  int res = scanf("%d%d%d", &n, &x, &y);
  if (res == -1) exit(0);
}
void Solve() {
  memset(vis, 0, sizeof(vis));
  memset(dis, LINF, sizeof(dis));
  dis[n] = 0;
  PQ.push({-dis[n], n});
  while (!PQ.empty()) {
    int u = PQ.top().second;
    PQ.pop();
    if (vis[u]) continue;
    vis[u] = 1;
    if (vis[0]) continue;
    if (u % 2 == 0) {
      int v = u / 2;
      long long cost = min(1LL * y, 1LL * (u / 2) * x);
      if (vis[v] == 0 && dis[v] > dis[u] + cost) {
        dis[v] = dis[u] + cost;
        PQ.push({-dis[v], v});
      }
      continue;
    }
    int v = u - 1;
    if (vis[v] == 0 && dis[v] > dis[u] + x) {
      dis[v] = dis[u] + x;
      PQ.push({-dis[v], v});
    }
    v = u + 1;
    if (vis[v] == 0 && dis[v] > dis[u] + x) {
      dis[v] = dis[u] + x;
      PQ.push({-dis[v], v});
    }
  }
  printf("%lld\n", dis[0]);
}
}  // namespace Solver
int main() {
  Solver::InitOnce();
  while (true) {
    Solver::Read();
    Solver::Solve();
  }
  return 0;
}