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.*;
import java.lang.*;

public class B623 {
    
    static class Solver {
	
		InputReader readerstream; 
		PrintWriter writerstream; // uncomment this
		//PrintStream writerstream;  // comment out this line

		Solver(InputReader r, PrintWriter wr) { 
		    this.readerstream = r;
		    this.writerstream = wr;   // uncomment this line
		    //this.writerstream = System.out; // comment out this line

		}
		/************************************************/
		
		final long inf = (long)1e16;

		int n; long a,b;
		long[] A;
		long[] p,g,f,dp;
		int idx;

		void addprimes(long z) {
			long k = 2;
			while (k*k <= z) {
				if (z % k == 0) {
					idx++; p[idx] = k;
					while (z % k == 0) z/=k;
				}
				k++;
			}
			if (z > 1) { idx++; p[idx] = z; }
		}

		public void run() {
		    n = gi(); a = gl(); b = gl(); A = new long[n+1]; p = new long[70]; Arrays.fill(p,-1);
		    if (n == 1) { prn(0); return; }
		    for (int i = 1; i <= n; i++) {
		    	A[i] = gl();
		    }
		    
		    idx = 0;

		    addprimes(A[1]-1); addprimes(A[1]); addprimes(A[1]+1);
		    addprimes(A[n]-1); addprimes(A[n]); addprimes(A[n]+1);

		    Arrays.sort(p,1,idx+1);
		    
		    

		    int k = 1;
		    while (p[k] != -1) {
		    	if (p[k] == p[k+1]) {
		    		p[k+1] = p[k+2];
		    	}
		    	k++;
		    }
		    k--;
		    
		    int N = k;
		    
		    

		    f = new long[n+2]; dp = new long[n+2];
		    g = new long[n+2];

		   	long ans = inf;

		    for (int j = 1; j <= N; j++) {
		    	Arrays.fill(f,0); Arrays.fill(g,0); Arrays.fill(dp,0);
		    	
		    	long P = p[j];

		    	for (int i = 1; i <= n; i++) {
		    		if (A[i] % P == 0) { g[i] = g[i-1]; }
		    		else if ( (A[i]-1)%P == 0 || (A[i]+1)%P == 0 ) { g[i] = g[i-1] + b; }
		    		else { g[i] = inf; }
		    	}

		    	for (int i = n; i >= 1; i--) {
		    		if (A[i] % P == 0) { f[i] = f[i+1]; }
		    		else if ( (A[i]-1)%P == 0 || (A[i]+1)%P == 0 ) { f[i] = f[i+1] + b; }
		    		else { f[i] = inf; }
		    		ans = Math.min(ans, f[i] + a*(i-1));
		    	}

		    	for (int i = n; i >= 1; i--) {
		    		dp[i] = Math.min(a + dp[i+1], f[i]);
		    		ans = Math.min(ans, g[i] + dp[i+1]);
		    	}
		    }



		    prn(ans); 
		}
		

		/***********************************************/

		int gi() { return readerstream.gi(); }
		long gl() { return readerstream.gl(); }
		double gd() { return readerstream.gd(); }
		String gs() { return readerstream.gs(); }
		String gline() { return readerstream.gline(); }
		void endc() { writerstream.println(); }
		void pr(Object x) { writerstream.print(x); }
		void prn(Object x) { writerstream.println(x); }
    }


    static class Pair {
		public int first,second;
		
		Pair(int first,int second) { this.first = first; this.second = second; }
		
		boolean equals(Pair b) {
		    if (this.first == b.first && this.second == b.second) { return true; }
		    return false;
		}
			
    }

    static class InputReader {
		BufferedReader br; StringTokenizer t;

		InputReader(InputStream s) {
		    br = new BufferedReader(new InputStreamReader(s));
		    t = null;
		}

		String next() {
		    while (t == null || !t.hasMoreTokens()) {
			try {
			    t = new StringTokenizer(br.readLine());
			} catch (Exception e) {
			    e.printStackTrace();
			}
		    }
		    return t.nextToken();
		}

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

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

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

		String gs() {
		    return next();
		}

		String gline() {
		    try { 
				return br.readLine();
		    } catch (Exception e) {
				e.printStackTrace();
			return "";
		    }
		}
    }


    // drivers
    
    public static void main(String[] args) {
		InputReader r = new InputReader(System.in);
		PrintWriter w = new PrintWriter(System.out);
		Solver s = new Solver(r,w);
		s.run();
		w.close();
    }

}
