You are given array ai of length n. You may consecutively apply two operations to this array:

  * remove some subsegment (continuous subsequence) of length m < n and pay for it m·a coins; 
  * change some elements of the array by at most 1, and pay b coins for each change. 



Please note that each of operations may be applied at most once (and may be not applied at all) so you can remove only one segment and each number may be changed (increased or decreased) by at most 1. Also note, that you are not allowed to delete the whole array.

Your goal is to calculate the minimum number of coins that you need to spend in order to make the greatest common divisor of the elements of the resulting array be greater than 1.

Input

The first line of the input contains integers n, a and b (1 ≤ n ≤ 1 000 000, 0 ≤ a, b ≤ 109) — the length of the array, the cost of removing a single element in the first operation and the cost of changing an element, respectively.

The second line contains n integers ai (2 ≤ ai ≤ 109) — elements of the array.

Output

Print a single number — the minimum cost of changes needed to obtain an array, such that the greatest common divisor of all its elements is greater than 1.

Examples

Input

3 1 4
4 2 3


Output

1


Input

5 3 2
5 17 13 5 6


Output

8


Input

8 3 4
3 7 5 4 3 12 9 4


Output

13

Note

In the first sample the optimal way is to remove number 3 and pay 1 coin for it.

In the second sample you need to remove a segment [17, 13] and then decrease number 6. The cost of these changes is equal to 2·3 + 2 = 8 coins.
import java.io.*;
import java.util.StringTokenizer;


public class SolutionCF623B {

	final boolean ONLINE_JUDGE = System.getProperty("ONLINE_JUDGE") != null;
	BufferedReader in;
	PrintWriter out;
	StringTokenizer tok = new StringTokenizer("");

	void solve() throws IOException {
		int t = 1;
		while (t-- > 0) {
			solveTest();
		}
	}

	void solveTest() throws IOException {
		int n = readInt();
		dp = new long[n][3];
		long a = readLong();
		long b = readLong();
		int[] x = readArr(n);
		long[] res = new long[6];
		res[0] = check(x[0] - 1, x, a, b);
		res[1] = check(x[0], x, a, b);
		res[2] = check(x[0] + 1, x, a, b);
		for (int i = 0, j = n - 1; i < j; i++, j--) {
			int tmp = x[i];
			x[i] = x[j];
			x[j] = tmp;
		}

		res[3] = check(x[0] - 1, x, a, b);
		res[4] = check(x[0], x, a, b);
		res[5] = check(x[0] + 1, x, a, b);

		long min = -1;
		for (int i = 0; i < 6; i++) {
			if (res[i] == -1) continue;
			if (min == -1 || res[i] < min) {
				min = res[i];
			}
		}

		out.println(min);
	}

	long check(long z, int[] x, long a, long b) {
		long res = -1;
		for(int i = 2; i * i <= z; i++) {
			if(z % i == 0) {
				while (z % i == 0) {
					z /= i;
				}
				long tmp = checkInternal(i, x, a, b);
				if (tmp != -1 && (res == -1 || tmp < res)) {
					res = tmp;
				}
			}
		}
		if(z != 1) {
			long tmp = checkInternal(z, x, a, b);
			if (tmp != -1 && (res == -1 || tmp < res)) {
				res = tmp;
			}
		}

		return res;
	}
	
	long[][] dp;

	long checkInternal(long gcd, int[] x, long a, long b) {
		int n = x.length;
		if (x[0] % gcd == 0) dp[0][0] = 0;
		else dp[0][0] = b;
		dp[0][1] = dp[0][2] = -1;
		for (int i = 1; i < n; i++) {
			boolean isDivide = x[i] % gcd == 0;
			boolean canDivide = (x[i] + 1) % gcd == 0 || (x[i] - 1) % gcd == 0;
			dp[i][0] = -1;
			if (dp[i - 1][0] != -1) {
				if (isDivide) {
					dp[i][0] = dp[i - 1][0];
				} else if (canDivide) {
					dp[i][0] = dp[i - 1][0] + b;
				}
			}

			dp[i][1] = -1;
			if (dp[i - 1][0] != -1) {
				dp[i][1] = dp[i - 1][0] + a;
			}
			if (dp[i - 1][1] != -1) {
				if (dp[i][1] == -1 || dp[i][1] > dp[i - 1][1] + a) {
					dp[i][1] = dp[i - 1][1] + a;
				}
			}

			dp[i][2] = -1;
			long prev = dp[i - 1][2];
			if (dp[i - 1][1] != -1) {
				if (prev == -1 || dp[i - 1][1] < dp[i - 1][2]) {
					prev = dp[i - 1][1];
				}
			}

			if (prev != -1) {
				if (isDivide) {
					dp[i][2] = prev;
				} else if (canDivide) {
					dp[i][2] = prev + b;
				}
			}
		}

		long res = -1;
		for (int i = 0; i < 3; i++) {
			if (dp[n - 1][i] == -1) continue;
			if (res == -1 || dp[n - 1][i] < res) {
				res = dp[n - 1][i];
			}
		}
		return res;
	}

	void init() throws FileNotFoundException {
		if (ONLINE_JUDGE) {
			in = new BufferedReader(new InputStreamReader(System.in));
			out = new PrintWriter(System.out);
		} else {
			in = new BufferedReader(new FileReader("input.txt"));
			out = new PrintWriter("output.txt");
		}
	}

	String readString() throws IOException {
		while (!tok.hasMoreTokens()) {
			tok = new StringTokenizer(in.readLine());
		}
		return tok.nextToken();
	}

	int readInt() throws IOException {
		return Integer.parseInt(readString());
	}

	long readLong() throws IOException {
		return Long.parseLong(readString());
	}

	double readDouble() throws IOException {
		return Double.parseDouble(readString());
	}

	int[] readArr(int n) throws IOException {
		int[] res = new int[n];
		for (int i = 0; i < n; i++) {
			res[i] = readInt();
		}
		return res;
	}

	long[] readArrL(int n) throws IOException {
		long[] res = new long[n];
		for (int i = 0; i < n; i++) {
			res[i] = readLong();
		}
		return res;
	}

	public static void main(String[] args) {
		new SolutionCF623B().run();
	}

	public void run() {
		try {
			long t1 = System.currentTimeMillis();
			init();
			solve();
			out.close();
			long t2 = System.currentTimeMillis();
			System.err.println("Time = " + (t2 - t1));
		} catch (Exception e) {
			e.printStackTrace(System.err);
			System.exit(-1);
		}
	}
}