#include <bits/stdc++.h>
using namespace std;
const long long INF = 0x3f3f3f3f3f3f3f3f;
const int MAXN = 1e6 + 6;
long long rcost, ccost, ans = INF;
int a1[MAXN], a[MAXN], N, P;
long long dp[MAXN][3];
long long f(int pos, int t) {
  if (pos == N - 1) return 0;
  long long &ret = dp[pos][t];
  if (ret != -1) return ret;
  ret = INF;
  if (t == 0 || t == 2) {
    if (a[pos] % P == 0) ret = min(ret, f(pos + 1, t));
    if ((a[pos] - 1) % P == 0) ret = min(ret, ccost + f(pos + 1, t));
    if ((a[pos] + 1) % P == 0) ret = min(ret, ccost + f(pos + 1, t));
    if (t == 0) ret = min(ret, f(pos, 1));
  }
  if (t == 1) {
    ret = min(ret, rcost + f(pos + 1, 1));
    ret = min(ret, f(pos, 2));
  }
  return ret;
}
int main() {
  scanf("%d%lld%lld", &N, &rcost, &ccost);
  for (int i = 0; i < (int)N; i++) scanf("%d", &a1[i]);
  for (int i = 0; i < (int)N - 1; i++) a[i] = a1[i + 1];
  long long p, m, pcost;
  for (int j = -1; j < (int)2; j++) {
    p = 2;
    m = a1[0] + j;
    pcost = ccost * (j != 0);
    while (p * p <= m) {
      if (m % p == 0) {
        P = p;
        while (m % p == 0) m /= p;
        memset(dp, -1, sizeof(dp));
        ans = min(ans, pcost + f(0, 0));
      }
      p++;
    }
    if (m != 1) {
      P = m;
      memset(dp, -1, sizeof(dp));
      ans = min(ans, pcost + f(0, 0));
    }
  }
  for (int i = 0; i < (int)N - 1; i++) a[i] = a1[i];
  for (int j = -1; j < (int)2; j++) {
    p = 2;
    m = a1[N - 1] + j;
    pcost = ccost * (j != 0);
    while (p * p <= m) {
      if (m % p == 0) {
        P = p;
        while (m % p == 0) m /= p;
        memset(dp, -1, sizeof(dp));
        ans = min(ans, pcost + f(0, 0));
      }
      p++;
    }
    if (m != 1) {
      P = m;
      memset(dp, -1, sizeof(dp));
      ans = min(ans, pcost + f(0, 0));
    }
  }
  printf("%lld\n", ans);
}
