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.util.Map;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.BufferedWriter;
import java.util.TreeMap;
import java.util.InputMismatchException;
import java.util.Set;
import java.io.BufferedReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.TreeSet;
import java.io.Writer;
import java.util.StringTokenizer;
import java.math.BigInteger;
import java.util.Collection;
import java.util.HashSet;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 * @author Andrey Rechitsky (arechitsky@gmail.com)
 */
public class Main {
	public static void main(String[] args) {
		InputStream inputStream = System.in;
		OutputStream outputStream = System.out;
		FastScanner in = new FastScanner(inputStream);
		FastPrinter out = new FastPrinter(outputStream);
		TaskB solver = new TaskB();
		solver.solve(1, in, out);
		out.close();
	}
}

class TaskB {
    public void solve(int testNumber, FastScanner in, FastPrinter out) {
        int n = in.nextInt();
        long c1 = in.nextInt();
        long c2 = in.nextInt();
        int[]a = in.nextIntArray(n);
        Factorizer f = new Factorizer();
        HashSet<Long> num = new HashSet<Long>();
        for (int i = 0; i < 2; i++) {
            for (int j = 0; j < 3; j++) {
                Map<Long,Integer> map = f.factorize(a[i==0?0:n-1]-1+j);
                for (long k:map.keySet()){
                    num.add(k);
                }
            }
        }
        long ans = c1*n;
        for (long div:num){
            long cur1 = 0, cur2 = 0, cur3=0;
            for (int i = 0; i < n; i++) {
                long tmp = a[i]%div;
                if (tmp==0){
                    cur3 = Math.min(cur3, cur2);
                    cur2 += c1;
                }
                else if (tmp == 1 || tmp == div-1){
                    cur3 = Math.min(cur2, cur3) + c2;
                    cur2 = Math.min(cur1, cur2) + c1;
                    cur1 += c2;
                }
                else {
                    cur3 = c1*n;
                    cur2 = Math.min(cur1, cur2) + c1;
                    cur1 = c1*n;
                }
            }
            ans = Math.min(ans,cur1);
            ans = Math.min(ans,cur2);
            ans = Math.min(ans,cur3);
        }
        out.printLine(ans);
    }
}

class FastScanner {

    private BufferedReader reader;
    private StringTokenizer st;

    public FastScanner(InputStream stream) {
        this.reader = new BufferedReader(new InputStreamReader(stream));
        this.st = new StringTokenizer("");
    }

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

    public String next() {
        while (!st.hasMoreTokens()) {
            st = new StringTokenizer(readLine());
        }
        return st.nextToken();
    }

    private String readLine() {
        String line = tryReadLine();
        if (line == null) throw new InputMismatchException();
        return line;
    }

    private String tryReadLine() {
        try {
            return reader.readLine();
        } catch (IOException e) {
            throw new InputMismatchException();
        }
    }

    public int[] nextIntArray(int size) {
        int[] array = new int[size];
        for (int i = 0; i < size; i++)
            array[i] = nextInt();
        return array;
    }

}

class FastPrinter {
    private final PrintWriter writer;

    public FastPrinter(OutputStream outputStream) {
        writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream)));
    }

    public void close() {
        writer.close();
    }

    public void printLine(long i) {
        writer.println(i);
    }

}

class Factorizer {
    public Set<Integer> primes;
    private long maxValue;

    public Factorizer() {
        this(1000000100);
    }

    public Factorizer(long maxValue) {
        this.primes = NumberUtils.generatePrimes((int) Math.sqrt(maxValue));
        this.maxValue = maxValue;
    }

    public Map<Long, Integer> factorize(long val) {
        if (val > maxValue) throw new IllegalArgumentException();
        Map<Long, Integer> map = new TreeMap<Long, Integer>();
        int j;
        for (long i : primes) {
            j = 0;
            while (val % i == 0) {
                ++j;
                val /= i;
            }
            if (j > 0) map.put(i, j);
            if (val == 1) break;
        }
        if (val != 1) map.put(val, 1);
        return map;
    }

}

class NumberUtils {
    public static Set<Integer> generatePrimes(int to) {
        Set<Integer> r = new TreeSet<Integer>();
        boolean[] primes = new boolean[to + 1];
        primes[0] = false;
        primes[1] = false;
        for (int i = 2; i < primes.length; i++) {
            primes[i] = true;
        }
        for (int i = 2; i < primes.length; i++) {
            if (!primes[i]) continue;
            r.add(i);
            for (int j = 2 * i; j < primes.length; j += i) {
                primes[j] = false;
            }
        }
        return r;
    }


}
