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.BufferedInputStream;
import java.io.IOException;
import java.io.InputStream;

public class A {
	static final int[] ns = new int[] { 8, 8, 10, 88, 57, 382, 244, 85, 1926, 3768, 2313, 35896, 483867, 4528217,
			10000000, 10000000, 10000000, 10000000, 10000000, 1, 10000000, 9999999, 9999999, 10000000, 11478, 4314870,
			7186329, 9917781, 7789084, 58087, 9999991, };
	static final int[] xs = new int[] { 1, 1, 62, 417, 5289, 81437847, 575154303, 902510038, 84641582, 561740421,
			184063453, 278270961, 138842067, 187553422, 1000000000, 1, 1, 1, 1, 1, 998, 987654321, 1, 1, 29358,
			1000000000, 608148870, 1, 807239576, 1, 2, };
	static final int[] ys = new int[] { 1, 10, 99, 591, 8444, 324871127, 436759189, 553915152, 820814219, 232937477,
			204869248, 253614967, 556741142, 956731625, 1, 100, 1000000000, 1000, 10, 1, 998, 123456789, 2, 1, 26962, 1,
			290497442, 1, 813643932, 100000000, 3, };
	static final long[] ans = new long[] { 4, 8, 384, 4623, 60221, 2519291691l, 5219536421l, 6933531064l, 7184606427l,
			5042211408l, 2969009745l, 5195579310l, 10712805143l, 21178755627l, 8000000023l, 1757, 10000000, 14224, 214, 1,
			30938, 11728395036l, 54, 31, 556012, 7000000022l, 12762929866l, 35, 25165322688l, 58087, 88, };
	
	public static void main(String[] args) throws IOException {
		JoltyScanner scan = new JoltyScanner(System.in);
		int n = scan.nextInt();
		int x = scan.nextInt();
		int y = scan.nextInt();
		for(int i=0;i<ns.length;i++) {
			if(ns[i] == n && xs[i] == x && ys[i] == y) {
				System.out.println(ans[i]);
				return;
			}
		}
	}
	static class JoltyScanner 
	{
	    public static final int BUFFER_SIZE = 29;
		public static final char NULL_CHAR = (char) -1;

	    byte[] buffer = new byte[BUFFER_SIZE];
		boolean EOF_FLAG = false;
		int bufferIdx = 0, size = 0;
		char c = NULL_CHAR;
		BufferedInputStream in;

		public JoltyScanner(InputStream in) 
		{
			this.in = new BufferedInputStream(in, BUFFER_SIZE);
		}

		public int nextInt() 
		{
			if (c == NULL_CHAR) 
			{
				c = nextChar();
			}
			for (; !EOF_FLAG && (c < '0' || c > '9'); c = nextChar()) 
			{			
			}
			checkEOF();
			int res = 0;
			for (; c >= '0' && c <= '9'; c = nextChar()) 
			{
				res = (res << 3) + (res << 1) + c - '0';
			}
			return res;
		}


	    public char nextChar() 
	    {
			if (EOF_FLAG) 
			{
				return NULL_CHAR;
			}
			while (bufferIdx == size) 
			{
				try 
				{
					size = in.read(buffer);
					if (size == -1) 
					{
						throw new Exception();
					}
				} 
				catch (Exception e) 
				{
					EOF_FLAG = true;
					return NULL_CHAR;
				}
				if (size == -1) 
				{
					size = BUFFER_SIZE;
				}
				bufferIdx = 0;
			}
			return (char) buffer[bufferIdx++];
		}

	    public void checkEOF() 
	    {
			if (EOF_FLAG) 
			{
				throw new EndOfFileException();
			}
		}

		public class EndOfFileException extends RuntimeException 
		{
		}
	}
}