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.*;

public class D {
	InputStream is;

	int __t__ = 1;
	int __f__ = 0;
	int __FILE_DEBUG_FLAG__ = __f__;
	String __DEBUG_FILE_NAME__ = "src/T";

	FastScanner in;
	PrintWriter out;

	final int MAX = 1000100;
	final long INF = (long)1e17;
	int a, b;
	HashSet<Integer> enumPrime(int val) {
		HashSet<Integer> res = new HashSet<Integer>();
		
		for (long i = 2; i * i <= val; i++) {
			if (val % i == 0) res.add((int)i);
			while (val % i == 0) {
				val /= i;
			}
		}
		if (val != 1) res.add(val);
		return res;
	}
	
	// dp[remove array not yet/removing/closed][index of current element of x]
	long calc(boolean usedA, int p, int[] x) {
		long[] next = new long[3];
		long[] prev = new long[3];
		
		Arrays.fill(prev, INF);
		if (usedA) prev[0] = b;
		else prev[0] = 0;
		
		int n = x.length;
		for (int i = 0; i < n; i++) {
			Arrays.fill(next, INF);
			if (x[i] % p == 0) {
				next[0] = Math.min(next[0], prev[0]);
				next[2] = Math.min(next[2], Math.min(prev[2], prev[1]));
			}
			if ((x[i] + 1) % p == 0 || (x[i] - 1) % p == 0) {
				next[0] = Math.min(next[0], prev[0] + b);
				next[2] = Math.min(next[2], Math.min(prev[2], prev[1]) + b);				
			}
			next[1] = Math.min(next[1], Math.min(prev[0], prev[1]) + a);
			
			long[] tmp = next; next = prev; prev = tmp;
		}
		long res = INF;
		for (int i = 0; i < 3; i++) {
			res = Math.min(res, prev[i]);
		}
		return res;
	}
	
	public void solve() {
		int n = in.nextInt(); 
		a = in.nextInt(); b = in.nextInt();
		int[] x = in.nextIntArray(n);
		
		long res = Long.MAX_VALUE;
		int[] xx = new int[n-1];
		for (int i = 1; i < n; i++)
			xx[i-1] = x[i];
		
		for (int next = x[0] - 1; next <= x[0] + 1; next++) {
			HashSet<Integer> hash = enumPrime(next);
			for (int p : hash) {
				boolean usedA = next != x[0];
				res = Math.min(res, calc(usedA, p, xx));
			}
		}
		
		for (int i = 0; i < n - 1; i++)
			xx[i] = x[i];
		for (int next = x[n-1] - 1; next <= x[n-1] + 1; next++) {
			HashSet<Integer> hash = enumPrime(next);
			for (int p : hash) {
				boolean usedA = next != x[n-1];
				res = Math.min(res, calc(usedA, p, xx));
			}
		}
		
		System.out.println(res);		
	}

	public void run() {
		if (__FILE_DEBUG_FLAG__ == __t__) {
			try {
				is = new FileInputStream(__DEBUG_FILE_NAME__);
			} catch (FileNotFoundException e) {
				// TODO 自動生成された catch ブロック
				e.printStackTrace();
			}
			System.out.println("FILE_INPUT!");
		} else {
			is = System.in;
		}
		in = new FastScanner(is);
		out = new PrintWriter(System.out);

		solve();
	}

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

	public void mapDebug(int[][] a) {
		System.out.println("--------map display---------");

		for (int i = 0; i < a.length; i++) {
			for (int j = 0; j < a[i].length; j++) {
				System.out.printf("%3d ", a[i][j]);
			}
			System.out.println();
		}

		System.out.println("----------------------------");
		System.out.println();
	}

	public void debug(Object... obj) {
		System.out.println(Arrays.deepToString(obj));
	}

	class FastScanner {
		private InputStream stream;
		private byte[] buf = new byte[1024];
		private int curChar;
		private int numChars;

		public FastScanner(InputStream stream) {
			this.stream = stream;
			//stream = new FileInputStream(new File("dec.in"));

		}

		int read() {
			if (numChars == -1)
				throw new InputMismatchException();
			if (curChar >= numChars) {
				curChar = 0;
				try {
					numChars = stream.read(buf);
				} catch (IOException e) {
					throw new InputMismatchException();
				}
				if (numChars <= 0)
					return -1;
			}
			return buf[curChar++];
		}

		boolean isSpaceChar(int c) {
			return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
		}

		boolean isEndline(int c) {
			return c == '\n' || c == '\r' || c == -1;
		}

		int nextInt() {
			return Integer.parseInt(next());
		}

		int[] nextIntArray(int n) {
			int[] array = new int[n];
			for (int i = 0; i < n; i++)
				array[i] = nextInt();

			return array;
		}

		int[][] nextIntMap(int n, int m) {
			int[][] map = new int[n][m];
			for (int i = 0; i < n; i++) {
				map[i] = in.nextIntArray(m);
			}
			return map;
		}

		long nextLong() {
			return Long.parseLong(next());
		}

		long[] nextLongArray(int n) {
			long[] array = new long[n];
			for (int i = 0; i < n; i++)
				array[i] = nextLong();

			return array;
		}

		long[][] nextLongMap(int n, int m) {
			long[][] map = new long[n][m];
			for (int i = 0; i < n; i++) {
				map[i] = in.nextLongArray(m);
			}
			return map;
		}

		double nextDouble() {
			return Double.parseDouble(next());
		}

		double[] nextDoubleArray(int n) {
			double[] array = new double[n];
			for (int i = 0; i < n; i++)
				array[i] = nextDouble();

			return array;
		}

		double[][] nextDoubleMap(int n, int m) {
			double[][] map = new double[n][m];
			for (int i = 0; i < n; i++) {
				map[i] = in.nextDoubleArray(m);
			}
			return map;
		}

		String next() {
			int c = read();
			while (isSpaceChar(c))
				c = read();
			StringBuilder res = new StringBuilder();
			do {
				res.appendCodePoint(c);
				c = read();
			} while (!isSpaceChar(c));
			return res.toString();
		}

		String[] nextStringArray(int n) {
			String[] array = new String[n];
			for (int i = 0; i < n; i++)
				array[i] = next();

			return array;
		}

		String nextLine() {
			int c = read();
			while (isEndline(c))
				c = read();
			StringBuilder res = new StringBuilder();
			do {
				res.appendCodePoint(c);
				c = read();
			} while (!isEndline(c));
			return res.toString();
		}
	}
}

