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.
#include <bits/stdc++.h>
using namespace std;
const long long INF = 3000000000000000000LL;
long long dp[1000001][3];
void pf(long a, set<long long> &s) {
  long long i;
  for (i = 2; i * i <= a; ++i) {
    if (a % i == 0) {
      s.insert(i);
      while (a % i == 0) a /= i;
    }
  }
  if (a > 1) s.insert(a);
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  long long i, j;
  long long n;
  long long A, B;
  cin >> n >> A >> B;
  vector<long long> a(n);
  for (i = 0; i < n; ++i) cin >> a[i];
  set<long long> p;
  pf(a[0] - 1, p);
  pf(a[0], p);
  pf(a[0] + 1, p);
  pf(a[n - 1] - 1, p);
  pf(a[n - 1], p);
  pf(a[n - 1] + 1, p);
  long long ans = INF;
  for (__typeof(p.begin()) it = p.begin(); it != p.end(); it++) {
    int d = *it;
    for (i = 0; i < 3; ++i) dp[0][i] = 0;
    for (i = 0; i < n; ++i) {
      long x = a[i] % d;
      if (x == 0) {
        dp[i + 1][0] = dp[i][0];
        dp[i + 1][1] = min(dp[i][0], dp[i][1] + A);
        dp[i + 1][2] = min(dp[i][1], dp[i][2]);
      } else if (x == 1 || x == d - 1) {
        dp[i + 1][0] = dp[i][0] + B;
        dp[i + 1][1] = min(dp[i][0] + B, dp[i][1] + A);
        dp[i + 1][2] = min(dp[i][1] + B, dp[i][2] + B);
      } else {
        dp[i + 1][0] = INF;
        dp[i + 1][1] = min(dp[i][0], dp[i][1]) + A;
        dp[i + 1][2] = dp[i + 1][1];
      }
    }
    long long tmp = INF;
    for (i = 0; i < 3; ++i) tmp = min(tmp, dp[n][i]);
    ans = min(ans, tmp);
  }
  cout << ans << endl;
  return 0;
}
