#include <bits/stdc++.h>
using namespace std;
const int N = 1000100;
const int mod = 1e9 + 7;
const long long llinf = (long long)2e18;
long long dp[N][3];
long long a[N];
long long n;
long long fi, se;
long long ans = llinf;
vector<long long> pr;
inline void get(long long x) {
  long long p = 2;
  while (p * p <= x) {
    if (x % p == 0) pr.push_back(p);
    while (x % p == 0) x /= p;
    p++;
  }
  if (x > 1) pr.push_back(x);
}
inline void calc() {
  long long res = llinf;
  for (int j = 0; j < pr.size(); ++j) {
    long long x = pr[j];
    for (int k = 0; k < 3; ++k) dp[0][k] = 0;
    for (int i = 1; i <= n; ++i)
      for (int k = 0; k < 3; ++k) dp[i][k] = llinf;
    for (int i = 1; i <= n; ++i) {
      int canstay = (a[i] % x == 0);
      int canchange = (((a[i] + 1) % x == 0) || ((a[i] - 1) % x == 0));
      dp[i][1] = dp[i - 1][1] + fi;
      dp[i][1] = min(dp[i][1], dp[i - 1][0] + fi);
      if (canstay) dp[i][0] = dp[i - 1][0];
      if (canchange) dp[i][0] = min(dp[i][0], dp[i - 1][0] + se);
      if (canstay) {
        dp[i][2] = min(dp[i][2], dp[i - 1][2]);
        dp[i][2] = min(dp[i][2], dp[i - 1][1]);
      }
      if (canchange) {
        dp[i][2] = min(dp[i][2], dp[i - 1][2] + se);
        dp[i][2] = min(dp[i][2], dp[i - 1][1] + se);
      }
    }
    res = min(res, min(dp[n][1], min(dp[n][2], dp[n][0])));
  }
  ans = min(ans, res);
}
int main() {
  scanf("%lld%lld%lld", &n, &fi, &se);
  for (int i = 1; i <= (int)n; ++i) scanf("%lld", a + i);
  get(a[1] + 1);
  get(a[1]);
  get(a[1] - 1);
  get(a[n] + 1);
  get(a[n] - 1);
  get(a[n]);
  calc();
  cout << ans;
  return 0;
}
