#include <bits/stdc++.h>
using namespace std;
const int P = 1e9 + 7, INF = 0x3f3f3f3f;
long long gcd(long long a, long long b) { return b ? gcd(b, a % b) : a; }
long long qpow(long long a, long long n) {
  long long r = 1 % P;
  for (a %= P; n; a = a * a % P, n >>= 1)
    if (n & 1) r = r * a % P;
  return r;
}
long long inv(long long first) {
  return first <= 1 ? 1 : inv(P % first) * (P - P / first) % P;
}
inline int rd() {
  int first = 0;
  char p = getchar();
  while (p < '0' || p > '9') p = getchar();
  while (p >= '0' && p <= '9') first = first * 10 + p - '0', p = getchar();
  return first;
}
const int N = 1e6 + 10;
int n, first, second;
int a[N], b[N];
long long ans;
long long solve(int g, int *a, int n) {
  if (g == 1) return 1e15;
  int L = n + 1, R = 0, toty = 0, totx = 0;
  for (int i = 0; i <= n; ++i) b[i] = 0;
  for (int i = 1; i <= n; ++i) {
    if (a[i] % g) {
      if ((a[i] - 1) % g && (a[i] + 1) % g) {
        L = min(L, i);
        R = i;
        ++totx;
      }
      b[i] = 1;
    }
  }
  for (int i = L; i <= R; ++i) b[i] = 0;
  for (int i = 1; i <= n; ++i) toty += b[i];
  totx = R - L + 1;
  long long ans = (long long)totx * first + (long long)toty * second;
  if (L == n + 1) {
    ans = (long long)toty * second;
    b[0] = 0;
    for (int i = 1; i <= n; ++i) b[i] += b[i - 1];
    long long mi = 0;
    for (int i = 1; i <= n; ++i) {
      ans = min(ans, (long long)toty * second + (long long)i * first -
                         (long long)b[i] * second + mi);
      mi = min(mi, -(long long)i * first + (long long)b[i] * second);
    }
    return ans;
  }
  int dx = 0, dy = 0;
  long long d = 0;
  for (int i = L - 1; i >= 1; --i) {
    ++dx;
    if (b[i]) --dy;
    d = min(d, (long long)dx * first + (long long)dy * second);
  }
  ans += d, d = 0, dx = dy = 0;
  for (int i = R + 1; i <= n; ++i) {
    ++dx;
    if (b[i]) --dy;
    d = min(d, (long long)dx * first + (long long)dy * second);
  }
  ans += d;
  return ans;
}
vector<int> fac(int num) {
  int mx = sqrt(num + 0.5);
  vector<int> v;
  for (int i = 2; i <= mx; ++i)
    if (num % i == 0) {
      v.push_back(i);
      while (num % i == 0) num /= i;
    }
  if (num > 1) v.push_back(num);
  return v;
}
void solve(int num, int *a, int n, int tp) {
  vector<int> g = fac(num);
  for (auto &&t : g) ans = min(ans, solve(t, a, n) + tp * second);
}
int main() {
  scanf("%d%d%d", &n, &first, &second);
  for (int i = 1; i <= n; ++i) scanf("%d", a + i);
  ans = 1e15;
  solve(a[1], a + 1, n - 1, 0);
  solve(a[1] - 1, a + 1, n - 1, 1);
  solve(a[1] + 1, a + 1, n - 1, 1);
  solve(a[n], a, n - 1, 0);
  solve(a[n] - 1, a, n - 1, 1);
  solve(a[n] + 1, a, n - 1, 1);
  printf("%lld\n", ans);
}
