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.util.*;
	import java.io.*;
	
	public class Test {
	public static void main(String args[]){
		InputReader in = new InputReader(System.in);
		PrintWriter out = new PrintWriter(System.out);
		long n = in.nextLong();
		double x = in.nextLong();
		double y = in.nextLong();
		long dp[] = new long[(int) (n+1)];
		dp[0] = 0;
		for(int i=1;i<=n;i++){
			dp[i] = (long) Math.min(dp[i-1] + x, dp[(i+1)/2] + y +(i%2)*x);
		}
		out.println(dp[(int) n]);
		out.close();
	}
	private static long gcd(double lcm, long b)
	{
	    while (b > 0)
	    {
	        long temp = b;
	        b = (long) (lcm % b); // % is remainder
	        lcm = temp;
	    }
	    return (long) lcm;
	}
	public static long fastExp(long base,long exp){
		long ret=1;
		while(exp>0){
			if(exp%2==1){
				ret=(ret*base)%1000000007;
			}
			exp/=2;
			base=(base*base)%1000000007;
		}
		return ret;
	}
	static class InputReader {
	
		private InputStream stream;
		private byte[] buf = new byte[8192];
		private int curChar, snumChars;
		private SpaceCharFilter filter;
	
		public InputReader(InputStream stream) {
			this.stream = stream;
		}
	
		public int snext() {
			if (snumChars == -1)
				throw new InputMismatchException();
			if (curChar >= snumChars) {
				curChar = 0;
				try {
					snumChars = stream.read(buf);
				} catch (IOException e) {
					throw new InputMismatchException();
				}
				if (snumChars <= 0)
					return -1;
			}
			return buf[curChar++];
		}
	
		public int nextInt() {
			int c = snext();
			while (isSpaceChar(c))
				c = snext();
			int sgn = 1;
			if (c == '-') {
				sgn = -1;
				c = snext();
			}
			int res = 0;
			do {
				if (c < '0' || c > '9')
					throw new InputMismatchException();
				res *= 10;
				res += c - '0';
				c = snext();
			} while (!isSpaceChar(c));
			return res * sgn;
		}
	
		public long nextLong() {
			int c = snext();
			while (isSpaceChar(c))
				c = snext();
			int sgn = 1;
			if (c == '-') {
				sgn = -1;
				c = snext();
			}
			long res = 0;
			do {
				if (c < '0' || c > '9')
					throw new InputMismatchException();
				res *= 10;
				res += c - '0';
				c = snext();
			} while (!isSpaceChar(c));
			return res * sgn;
		}
	
		public int[] nextIntArray(int n) {
			int a[] = new int[n];
			for (int i = 0; i < n; i++)
				a[i] = nextInt();
			return a;
		}
	
		public String readString() {
			int c = snext();
			while (isSpaceChar(c))
				c = snext();
			StringBuilder res = new StringBuilder();
			do {
				res.appendCodePoint(c);
				c = snext();
			} while (!isSpaceChar(c));
			return res.toString();
		}
	
		public boolean isSpaceChar(int c) {
			if (filter != null)
				return filter.isSpaceChar(c);
			return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
		}
	
		public interface SpaceCharFilter {
			public boolean isSpaceChar(int ch);
		}
	}
	}