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.util.stream.Stream;

public class Main implements Runnable {
    static final int MOD = (int) 1e9 + 7;
    static final int MI = (int) 1e9;
    static final long ML = (long) 1e18;
    static final Reader in = new Reader();
    static final PrintWriter out = new PrintWriter(System.out);
    StringBuilder answer = new StringBuilder();

    public static void main(String[] args) {
        new Thread(null, new Main(), "persefone", 1 << 32).start();
    }

    @Override
    public void run() {
        solve();
        printf();
        flush();
    }

    private Set<Integer> divSet = new HashSet<>();
    private int[] c;
    private int n;
    private long x, y;

    void solve() {

        n = in.nextInt();
        x = in.nextInt();
        y = in.nextInt();
        c = new int[n + 1];
        for (int i = 1; i <= n; i++) {
            c[i] = in.nextInt();
        }
        for (int i = -1; i <= 1; i++) {
            add(c[1] + i);
            add(c[n] + i);
        }
        divSet.remove(1);

        int[] divArr = divSet.stream().mapToInt(Integer::intValue).sorted().toArray();
        boolean[] check = new boolean[divArr.length];
        for (int i = 0; i < divArr.length; i++) {
            for (int j = i + 1; j < divArr.length; j++) {
                if (divArr[j] % divArr[i] == 0) {
                    check[j] = true;
                }
            }
        }
        List<Integer> divList = new ArrayList<>();
        for (int i = 0; i < divArr.length; i++) {
            if (!check[i]) {
                divList.add(divArr[i]);
            }
        }
        long ans = ML;
        for (int d : divList) {
            ans = Math.min(ans, best(d));
        }
        printf(ans);
    }

    public void add(int d) {
        for (int i = 1; i <= Math.sqrt(d); i++) {
            if (d % i == 0) {
                divSet.add(i);
                divSet.add(d / i);
            }
        }
    }

    public long best(int d) {
        long[] modify = new long[n + 1];
        int first = n + 1, last = 0;
        for (int i = 1; i <= n; i++) {
            int r = c[i] % d;
            if (r == 0) continue;
            if (r == 1 || r == d - 1) {
                modify[i] = y;
            } else {
                last = first == n + 1 ? (first = i) : i;
            }
        }
        long ans = 0;
        if (first <= last) {
            ans = x * (last - first + 1);
            if (first > 1) {
                long[] left = new long[first + 1];
                for (int i = 1; i < first; i++) {
                    left[i] = modify[i];
                }
                ans += getLeft(left, first);
            }
            if (last < n) {
                long[] right = new long[n - last + 1];
                for (int i = last + 1; i <= n; i++) {
                    right[i - last] = modify[i];
                }
                ans += getRight(right, n - last);
            }

            if (first == 1) modify[1] = ML;
            if (last == n) modify[n] = ML;
            long res = Math.min(modify[1], modify[n]) + x * (n - 1);
            ans = Math.min(ans, res);
        } else {
            for (int i = 1; i <= n; i++) {
                ans += modify[i];
                modify[i] -= x;
            }

            long res1 = get(modify, n);
            for (int i = 1; i <= n / 2; i++) {
                long cmp = modify[i];
                modify[i] = modify[n - i + 1];
                modify[n - i + 1] = cmp;
            }

            long res2 = get(modify, n);
            ans -= Math.max(res1, res2);
        }
        return ans;
    }

    public long getLeft(long[] a, int m) {
        long ans = ML, sum = 0;
        for (int i = 1; i < m; i++) {
            sum += a[i];
            ans = Math.min(ans, sum + x * (m - i - 1));
        }
        ans = Math.min(ans, sum);
        return ans;
    }

    public long getRight(long[] a, int m) {
        long ans = ML;
        long[] sum = new long[m + 1];
        for (int i = 1; i <= m; i++) {
            sum[i] = sum[i - 1] + a[i];
        }
        for (int i = 1; i <= m; i++) {
            ans = Math.min(ans, x * i + sum[m] - sum[i]);
        }
        ans = Math.min(ans, sum[m]);
        return ans;
    }

    public long get(long[] a, int m) {
        long ans = 0, min = 0, sum = 0;
        for (int i = 1; i < m; i++) {
            sum += a[i];
            ans = Math.max(ans, sum - min);
            min = Math.min(min, sum);
        }
        return ans;
    }

    void printf() {
        out.print(answer);
    }

    void close() {
        out.close();
    }

    void flush() {
        out.flush();
    }

    void printf(Stream<?> str) {
        str.forEach(o -> add(o, " "));
        add("\n");
    }


    void printf(Object... obj) {
        printf(false, obj);
    }

    void printfWithDescription(Object... obj) {
        printf(true, obj);
    }


    private void printf(boolean b, Object... obj) {

        if (obj.length > 1) {
            for (int i = 0; i < obj.length; i++) {
                if (b) add(obj[i].getClass().getSimpleName(), " - ");
                if (obj[i] instanceof Collection<?>) {
                    printf((Collection<?>) obj[i]);
                } else if (obj[i] instanceof int[][]) {
                    printf((int[][]) obj[i]);
                } else if (obj[i] instanceof long[][]) {
                    printf((long[][]) obj[i]);
                } else if (obj[i] instanceof double[][]) {
                    printf((double[][]) obj[i]);
                } else printf(obj[i]);
            }
            return;
        }

        if (b) add(obj[0].getClass().getSimpleName(), " - ");
        printf(obj[0]);
    }

    void printf(Object o) {
        if (o instanceof int[])
            printf(Arrays.stream((int[]) o).boxed());
        else if (o instanceof char[])
            printf(new String((char[]) o));
        else if (o instanceof long[])
            printf(Arrays.stream((long[]) o).boxed());
        else if (o instanceof double[])
            printf(Arrays.stream((double[]) o).boxed());
        else if (o instanceof boolean[]) {
            for (boolean b : (boolean[]) o) add(b, " ");
            add("\n");
        } else
            add(o, "\n");
    }

    void printf(int[]... obj) {
        for (int i = 0; i < obj.length; i++) printf(obj[i]);
    }

    void printf(long[]... obj) {
        for (int i = 0; i < obj.length; i++) printf(obj[i]);
    }

    void printf(double[]... obj) {
        for (int i = 0; i < obj.length; i++) printf(obj[i]);
    }

    void printf(boolean[]... obj) {
        for (int i = 0; i < obj.length; i++) printf(obj[i]);
    }

    void printf(Collection<?> col) {
        printf(col.stream());
    }

    <T, K> void add(T t, K k) {
        if (t instanceof Collection<?>) {
            ((Collection<?>) t).forEach(i -> add(i, " "));
        } else if (t instanceof Object[]) {
            Arrays.stream((Object[]) t).forEach(i -> add(i, " "));
        } else
            add(t);
        add(k);
    }


    <T> void add(T t) {
        answer.append(t);
    }

    static class Reader {
        private BufferedReader br;
        private StringTokenizer st;

        Reader() {
            br = new BufferedReader(new InputStreamReader(System.in));
        }

        Reader(String fileName) throws FileNotFoundException {
            br = new BufferedReader(new FileReader(fileName));
        }

        boolean isReady() throws IOException {
            return br.ready();
        }

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

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

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

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

        String nextLine() {
            String s = "";
            try {
                s = br.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return s;
        }
    }
}