#include <bits/stdc++.h>
using namespace std;
template <class T>
T Bitcnt(T a) {
  int sum = 0;
  while (a) {
    if (a & 1) sum++;
    a /= 2;
  }
  return sum;
}
template <class T>
T Max3(T a, T b, T c) {
  return max(a, max(b, c));
}
template <class T>
T Lcm(T a, T b) {
  T tmp = __gcd(a, b);
  return (a / tmp) * b;
}
template <class T>
T Pow(T a, T b) {
  T ans = 1;
  T base = a;
  while (b) {
    if (b & 1) ans = (ans * base);
    base = (base * base);
    b /= 2;
  }
  return ans;
}
long long Bigmod(long long a, long long b) {
  long long res = 1;
  long long pw = a % 1000000007LL;
  while (b > 0) {
    if (b & 1) res = (res * pw) % 1000000007LL;
    pw = (pw * pw) % 1000000007LL;
    b /= 2;
  }
  return res;
}
int a_x[] = {1, -1, 0, 0};
int a_y[] = {0, 0, 1, -1};
long long X, Y;
void extend_euclid(long long a, long long b) {
  if (b == 0) {
    X = a;
    Y = 0;
    return;
  }
  extend_euclid(b, a % b);
  long long x, y;
  x = Y;
  y = X - (a / b) * Y;
  X = x;
  Y = y;
}
long long inverse_modulo(long long a, long long b) {
  extend_euclid(a, b);
  return (X + 1000000007LL) % 1000000007LL;
}
long long dp[3][1000006];
set<int> st;
void factor(int x) {
  for (int i = 2; i <= sqrt(x); i++) {
    if (x % i == 0) {
      st.insert(i);
      while (x % i == 0) x /= i;
    }
  }
  if (x > 1) st.insert(x);
}
int n;
int a[2000006];
int x;
long long A, b;
long long solve(int curr, int indx) {
  if (indx > n) {
    return 0;
  }
  long long &ret = dp[curr][indx];
  if (ret != -1) return ret;
  ret = (long long)1e16;
  if (a[indx] % x == 0 && (curr == 0 || curr == 2))
    ret = min(ret, solve(curr, indx + 1));
  if (curr == 2 || curr == 0) {
    if ((a[indx] + 1) % x == 0 || (a[indx] - 1) % x == 0) {
      ret = min(ret, b + solve(curr, indx + 1));
    }
  }
  if (a[indx] % x != 0) {
    if (curr == 0 || curr == 1) {
      ret = min(ret, A + solve(1, indx + 1));
      ret = min(ret, A + solve(2, indx + 1));
    }
  }
  if (curr == 1) {
    ret = min(ret, A + solve(1, indx + 1));
    ret = min(ret, A + solve(2, indx + 1));
  }
  return min(ret, (long long)1e16);
}
int main() {
  scanf("%d", &n);
  scanf("%lld %lld", &A, &b);
  for (int i = 1; i <= n; i++) scanf("%d", &a[i]);
  factor(a[1] + 1);
  factor(a[1]);
  factor(a[1] - 1);
  factor(a[n] + 1);
  factor(a[n]);
  factor(a[n] - 1);
  memset(dp, -1, sizeof dp);
  long long res = (long long)1e18;
  for (set<int>::iterator it = st.begin(); it != st.end(); it++) {
    x = *it;
    memset(dp, -1, sizeof dp);
    res = min(res, solve(0, 1));
  }
  cout << res << endl;
  return 0;
}
