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 JAVA):

Solution:
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.Comparator;

public class d1  extends PrintWriter {

    static BufferedReader s = new BufferedReader(new InputStreamReader(System.in));
    // static Scanner s=new Scanner(System.in);
    d1 () { super(System.out); }
    public static void main(String[] args) throws IOException{
        d1  d1=new d1 ();d1.main();d1.flush();
    }
    void main() throws IOException {
        BufferedReader s = new BufferedReader(new InputStreamReader(System.in));
        StringBuffer sb = new StringBuffer();
        StringBuffer sb1 = new StringBuffer();
        PrintWriter out = new PrintWriter(System.out);
          String[] s1 = s();
           int n=i(s1[0]);long x=i(s1[1]);long y=i(s1[2]);
           long[] dp=new long[2*n+1];
           Arrays.fill(dp,Long.MAX_VALUE);
           dp[0]=0;
           for(int i=1;i<=2*n;i++){
               dp[i]=Math.min(dp[i],dp[i-1]+x);
               dp[n]=Math.min(dp[n],dp[i]+(long)Math.abs(i-n)*x);


                if(2*i<=2*n){
                    dp[2*i]=Math.min(dp[2*i],dp[i]+y);
                     dp[2*(i-1)]=Math.min(dp[2*(i-1)],dp[i]+x+y);
                     dp[n]=Math.min(dp[n],dp[2*i]+(long)Math.abs(2*i-n)*x);
                }
           }
        System.out.println(dp[n]);
    }
    public void sort(int[] a,int l,int h){
        if(l==h) return;
        int mid=(l+h)/2;

        sort(a,l,mid);
        sort(a,mid+1,h);
        merge(a,l,(l+h)/2,h);
    }
    void merge(int arr[], int l, int m, int r)
    {
        int n1 = m - l + 1;
        int n2 = r - m;
        int L[] = new int[n1];
        int R[] = new int[n2];
        for (int i = 0; i < n1; ++i)
            L[i] = arr[l + i];
        for (int j = 0; j < n2; ++j)
            R[j] = arr[m + 1 + j];
        int i = 0, j = 0;
        int k = l;
        while (i < n1 && j < n2) {
            if (L[i] <= R[j]) {
                arr[k] = L[i];
                i++;
            }
            else {
                arr[k] = R[j];
                j++;
            }
            k++;
        }

        while (i < n1) {
            arr[k] = L[i];
            i++;
            k++;
        }
        while (j < n2) {
            arr[k] = R[j];
            j++;
            k++;
        }
    }


    static long gcd(long a, long b) {
        if (b == 0)
            return a;
        return gcd(b, a % b);
    }
    static String[] s() throws IOException {
        return s.readLine().trim().split("\\s+");
    }

    static int i(String ss) {
        return Integer.parseInt(ss);
    }
    static long l(String ss) {
        return Long.parseLong(ss);
    }
}
class Student {
    long  a;long b;int i;long val;
    public Student(long a,long b,int i,long val) {
      this.a=a;this.b=b;this.i=i;this.val=val;
    }
}
class Pair {
    int  a,b;long val;int edgeVal;int train;
    public Pair(int  a,long val,int train){
        this.a=a;this.val=val;this.train=train;}
}
class Sortbyroll implements Comparator<Student> {

    public int compare(Student a, Student b){
        if(a.a<b.a) return 1;
        else if(a.a==b.a){return 0;}
        return -1;  }
}