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;
long long delbit(long long a, long long k) { return a & (~(1 << k)); }
bool getbit(long long a, long long k) { return 1 & (a >> k); }
long long setbit(long long a, long long k) { return a |= (1 << k); }
inline long long mulmod(long long first, long long n, long long _mod) {
  long long res = 0;
  while (n) {
    if (n & 1) res = (res + first) % _mod;
    first = (first + first) % _mod;
    n >>= 1;
  }
  return res;
}
inline long long powmod(long long first, long long n, long long _mod) {
  long long res = 1;
  while (n) {
    if (n & 1) res = (res * first) % _mod;
    first = (first * first) % _mod;
    n >>= 1;
  }
  return res;
}
inline long long gcd(long long a, long long b) {
  long long t;
  while (b) {
    a = a % b;
    t = a;
    a = b;
    b = t;
  }
  return a;
}
inline int gcd(int a, int b) {
  int t;
  while (b) {
    a = a % b;
    t = a;
    a = b;
    b = t;
  }
  return a;
}
inline long long lcm(long long a, long long b) { return a / gcd(a, b) * b; }
inline long long gcd(long long a, long long b, long long c) {
  return gcd(gcd(a, b), c);
}
inline int gcd(int a, int b, int c) { return gcd(gcd(a, b), c); }
double dist(double ax, double ay, double bx, double by) {
  return sqrt(((ax - bx) * (ax - bx)) + ((ay - by) * (ay - by)));
}
template <typename T, typename T2>
void printarr(T a[], T2 sz, T2 beg = 0) {
  for (T2 i = beg; i < sz; i++) cout << a[i] << " ";
  cout << endl;
}
long long dp[20001000];
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int n, first, second;
  cin >> n >> first >> second;
  fill(dp, dp + 2 * n, 1000111000111000111LL);
  bool change = 1;
  dp[0] = 0;
  while (change) {
    change = 0;
    for (int(i) = (1); (i) < (2 * n + 1); (i)++) {
      if (dp[i] > dp[i - 1] + first) {
        change = 1;
        dp[i] = dp[i - 1] + first;
      }
    }
    for (int i = 1; i <= n; i++) {
      if (dp[i * 2] > dp[i] + second) {
        change = 1;
        dp[i * 2] = dp[i] + second;
      }
    }
    for (int i = 2 * n; i >= 2; i--) {
      if (dp[i - 1] > dp[i] + first) {
        change = 1;
        dp[i - 1] = dp[i] + first;
      }
    }
  }
  cout << dp[n] << endl;
  return 0;
}