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 n, x, y;
long long dis[20000005];
bool vis[20000005];
void dij() {
  for (int i = 1; i <= n * 2; i++) dis[i] = 1e18;
  dis[0] = 0;
  multiset<pair<long long, long long> > ms;
  ms.insert({0, 0});
  while (!ms.empty()) {
    long long s = (*ms.begin()).second;
    long long p = (*ms.begin()).first;
    ms.erase(ms.begin());
    if (s > 20000000) continue;
    if (vis[s]) continue;
    vis[s] = 1;
    {
      long long h = s * 2;
      if (h <= 20000000) {
        if (y + dis[s] < dis[h]) {
          dis[h] = dis[s] + y;
          ms.insert({dis[h], h});
        }
      }
      h = s + 1;
      if (x + dis[s] < dis[h]) {
        dis[h] = dis[s] + x;
        ms.insert({dis[h], h});
      }
    }
    {
      long long h = s - 1;
      if (h >= 0) {
        if (dis[s] + x < dis[h]) {
          dis[h] = dis[s] + x;
          ms.insert({dis[h], h});
        }
      }
    }
    if (s == n) {
      return;
    }
  }
}
int main() {
  cin >> n >> x >> y;
  for (int i = 0; i <= n; i++) dis[i] = i * x;
  for (int i = 0; i <= n; i++) {
    dis[2 * i] = min(dis[2 * i], dis[i] + y);
    dis[2 * i + 1] = min(dis[2 * i + 1], dis[i] + x + y);
    if (i) dis[2 * i - 1] = min(dis[2 * i - 1], dis[i] + x + y);
  }
  cout << dis[n] << endl;
  return 0;
}