#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e6 + 6;
const int M = 32000;
struct FastIO {
  static const int S = 1310720;
  int wpos;
  char wbuf[S];
  FastIO() : wpos(0) {}
  inline int xchar() {
    static char buf[S];
    static int len = 0, pos = 0;
    if (pos == len) pos = 0, len = fread(buf, 1, S, stdin);
    if (pos == len) return -1;
    return buf[pos++];
  }
  inline int xuint() {
    int c = xchar(), x = 0;
    while (c <= 32) c = xchar();
    for (; '0' <= c && c <= '9'; c = xchar()) x = x * 10 + c - '0';
    return x;
  }
  inline void wchar(int x) {
    if (wpos == S) fwrite(wbuf, 1, S, stdout), wpos = 0;
    wbuf[wpos++] = x;
  }
  inline void wint(long long x) {
    if (x < 0) wchar('-'), x = -x;
    char s[24];
    int n = 0;
    while (x || !n) s[n++] = '0' + x % 10, x /= 10;
    while (n--) wchar(s[n]);
  }
  ~FastIO() {
    if (wpos) fwrite(wbuf, 1, wpos, stdout), wpos = 0;
  }
} io;
bool ispri[M];
int pri[M];
void init_ispri() {
  memset(ispri, 1, sizeof(ispri));
  int i, j;
  for (i = 2; i * i <= M; i++)
    if (ispri[i])
      for (j = i * i; j <= M; j += i) ispri[j] = 0;
  int cnt = 1;
  for (i = 2; i <= M; i++)
    if (ispri[i]) pri[cnt++] = i;
}
void get_pri_tab(int x, vector<int> &v) {
  int nn = x;
  int p = 1;
  while (pri[p] * pri[p] <= nn) {
    if (nn % pri[p])
      p++;
    else {
      v.push_back(pri[p]);
      while (nn % pri[p] == 0) nn /= pri[p];
      p++;
    }
  }
  if (nn > 1) v.push_back(nn);
}
int a[maxn];
long long dp[2][3];
const long long INF = 0x7F7F7F7F7F7F7F7F;
int main() {
  init_ispri();
  int n = io.xuint(), A = io.xuint(), B = io.xuint();
  for (int i = 1; i <= n; i++) a[i] = io.xuint();
  vector<int> v;
  get_pri_tab(a[1], v);
  get_pri_tab(a[1] - 1, v);
  get_pri_tab(a[1] + 1, v);
  get_pri_tab(a[n], v);
  get_pri_tab(a[n] - 1, v);
  get_pri_tab(a[n] + 1, v);
  long long ans = 9223372036854775807LL;
  for (auto &p : v) {
    int cur = 0;
    dp[0][0] = dp[0][1] = dp[0][2] = 0;
    for (int i = 1; i <= n; i++) {
      cur ^= 1;
      memset(dp[cur], 0x7f, sizeof(dp[cur]));
      if (!(a[i] % p)) {
        dp[cur][0] = min(dp[cur][0], dp[cur ^ 1][0]);
        dp[cur][2] = min(dp[cur][2], dp[cur ^ 1][1]);
        dp[cur][2] = min(dp[cur][2], dp[cur ^ 1][2]);
      }
      if (!((a[i] - 1) % p)) {
        dp[cur][0] = min(dp[cur][0], dp[cur ^ 1][0] + B);
        dp[cur][2] = min(dp[cur][2], dp[cur ^ 1][1] + B);
        dp[cur][2] = min(dp[cur][2], dp[cur ^ 1][2] + B);
      }
      if (!((a[i] + 1) % p)) {
        dp[cur][0] = min(dp[cur][0], dp[cur ^ 1][0] + B);
        dp[cur][2] = min(dp[cur][2], dp[cur ^ 1][1] + B);
        dp[cur][2] = min(dp[cur][2], dp[cur ^ 1][2] + B);
      }
      dp[cur][1] = min(dp[cur][1], dp[cur ^ 1][0] + A);
      dp[cur][1] = min(dp[cur][1], dp[cur ^ 1][1] + A);
      if (dp[cur][0] == INF && dp[cur][1] == INF && dp[cur][2] == INF) break;
    }
    ans = min(ans, min(dp[cur][0], min(dp[cur][1], dp[cur][2])));
  }
  io.wint(ans);
  return 0;
}
