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 exp(long long b, long long e) {
  if (b == 1 || e == 0) return 1;
  if (e == 1) return b % 1000000007;
  if (e == 2) return (b * b) % 1000000007;
  return ((e % 2 == 0)
              ? exp(exp(b, e / 2), 2) % 1000000007
              : (b * (exp(exp(b, e / 2), 2) % 1000000007)) % 1000000007);
}
long long z[20000002];
int main() {
  long long n, x, y, i, m;
  cin >> n >> x >> y;
  m = (long long)(log2((double)n)) + 1;
  m = pow(2, m);
  memset(z, 0, sizeof(z));
  for (i = 1; i <= (((m) < (20000000)) ? (m) : (20000000)); ++i) {
    if (i % 2 == 1)
      z[i] = z[i - 1] + x;
    else {
      if (z[i / 2] + y < z[i - 1] + x) {
        z[i] = z[i / 2] + y;
        int k = i - 1;
        while (k > 0 && z[k] > z[k + 1] + x) z[k] = z[k + 1] + x;
      } else
        z[i] = z[i - 1] + x;
    }
  }
  cout << z[n] << endl;
  return 0;
}