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:
//package GeneralProblems;

import java.util.Arrays;
import java.util.Scanner;

public class GenerateAString {
	static long x, y;
	static long memo[];
	static long n;
	static int findBiggestPow(long x) {
		int low = 0;
		int ans = 0;
		int high = 30;
		while(low<=high) {
			int mid = (low+high)/2;
			if(1<<mid >x) {
				high=mid-1;
			}else if(1<<mid==x)
				return mid;
			else{
				ans = Math.max(ans, mid);
				low = mid+1;
			}
		}
		return ans;
	}
	static long dp(int cur) {
//		System.out.println(cur);
		if (cur == 0)
			return memo[cur]=0;
		if(cur ==1)
			return memo[1]=x;
		if(memo[cur]!=-1)
			return memo[cur];
		long oneWay = dp(cur-1)+x;
		
		if((cur&1)!=0)
			oneWay = Math.min(oneWay, dp(cur/2)+y);
		else
			oneWay = Math.min(oneWay, dp((cur+1)/2)  +y+x);

		return memo[cur] = oneWay;

	}

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		n = sc.nextLong();
		x = sc.nextLong();
		y = sc.nextLong();
		memo = new long[(int) n+1];
		memo[0]=0;
		memo[1]=x;
		for (int i = 2; i < memo.length; i++) {
			memo[i]=memo[i-1]+x;
			if((i&1)==0)
				memo[i]=Math.min(memo[i], memo[i/2]+y);
			else
				memo[i]=Math.min(memo[i], memo[(i+1)/2]+x+y);
		}
		System.out.println(memo[(int)n]);
	}
}