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 long long MAXN = 1000005;
const long long SQRTN = 1003;
const long long LOGN = 22;
const double PI = acos(-1);
const long long INF = 1e16;
const long long MOD = 1000000007;
const long long FMOD = 998244353;
const double eps = 1e-9;
bool primes[100001];
long long spf[100001];
void sieve() {
  primes[0] = primes[1] = false;
  for (long long i = 1; i <= 100000; i++) {
    spf[i] = i;
    primes[i] = true;
  }
  spf[2] = 2;
  for (long long i = 4; i <= 100000; i += 2) {
    spf[i] = 2;
    primes[i] = false;
  }
  for (long long i = 3; i * i <= 100000; i += 2) {
    if (spf[i] == i) {
      for (long long j = i * i; j <= 100000; j += i) {
        if (spf[j] == j) spf[j] = i;
        primes[j] = false;
      }
    }
  }
  return;
}
long long power(long long n, long long m, long long p) {
  long long res = 1;
  n = n % MOD;
  while (m > 0) {
    if (m & 1) {
      res = ((res) % p * (n) % p) % p;
      m--;
    }
    n = ((n) % p * (n) % p) % p;
    m >>= 1;
  }
  return res;
}
long long N = 10000;
long long factorialNumInverse[100001];
long long naturalNumInverse[100001];
long long fact[100001];
void InverseofNumber(long long p) {
  naturalNumInverse[0] = naturalNumInverse[1] = 1;
  for (long long i = 2; i <= N; i++)
    naturalNumInverse[i] = naturalNumInverse[p % i] * (p - p / i) % p;
}
void InverseofFactorial(long long p) {
  factorialNumInverse[0] = factorialNumInverse[1] = 1;
  for (long long i = 2; i <= N; i++)
    factorialNumInverse[i] =
        (naturalNumInverse[i] * factorialNumInverse[i - 1]) % p;
}
void factorial(long long p) {
  fact[0] = 1;
  for (long long i = 1; i <= N; i++) {
    fact[i] = (fact[i - 1] * i) % p;
  }
}
long long Binomial(long long N, long long R, long long p) {
  long long ans =
      ((fact[N] * factorialNumInverse[R]) % p * factorialNumInverse[N - R]) % p;
  return ans;
}
long long modInverse(long long n, long long p) { return power(n, p - 2, p); }
long long nCrModPFermat(long long n, long long r, long long p) {
  if (n < r) return 0;
  if (r == 0) return 1;
  long long fac[n + 1];
  fac[0] = 1;
  for (long long i = 1; i <= n; i++) fac[i] = (fac[i - 1] * i) % p;
  return (fac[n] * modInverse(fac[r], p) % p * modInverse(fac[n - r], p) % p) %
         p;
}
void solvethetestcase();
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long t = 1;
  for (long long testcase = 1; testcase < t + 1; testcase++) {
    solvethetestcase();
  }
}
long long n, m, a, b, c, d, e, f, g, h, i, j, k, l, o, r, s, u, v, w, x, y, one,
    zero, p, t1, t2, t, q, cnt, val, res;
long long dp[10000001];
void solvethetestcase() {
  cin >> n >> x >> y;
  for (long long i = 1; i <= n; i++) {
    if (i & 1)
      dp[i] = min(x + dp[i - 1], y + x + dp[(i + 1) / 2]);
    else
      dp[i] = min(x + dp[i - 1], y + dp[i / 2]);
  }
  cout << dp[n];
}