#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e6 + 5;
int n, x, y;
vector<int> a;
long long f[maxn][3];
long long Cost(int num, int gcd, int del) {
  if (del) return x;
  num %= gcd;
  if (num == 0) return 0;
  if (num == 1 || num == gcd - 1) return y;
  return 1e15;
}
long long Calc(int gcd) {
  f[n][0] = f[n][1] = f[n][2] = 0;
  for (int i = n - 1; i >= 0; --i) {
    long long c0 = Cost(a[i], gcd, 0);
    long long c1 = Cost(a[i], gcd, 1);
    f[i][0] = min(f[i + 1][0] + c0, f[i + 1][1] + c1);
    f[i][1] = min(f[i + 1][1] + c1, f[i + 1][2] + c0);
    f[i][2] = f[i + 1][2] + c0;
    if (f[i][0] > 1e17) f[i][0] = 1e17;
    if (f[i][1] > 1e17) f[i][1] = 1e17;
    if (f[i][2] > 1e17) f[i][2] = 1e17;
  }
  return f[0][0];
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cin >> n >> x >> y;
  a.resize(n);
  for (int i = 0; i < n; ++i) {
    cin >> a[i];
  }
  vector<int> candidate;
  for (int x = -1; x <= 1; ++x) {
    candidate.push_back(a[0] + x);
    candidate.push_back(a.back() + x);
  }
  long long res = 1ll * n * x;
  for (int gcd = 2; gcd * gcd <= 1e9; ++gcd) {
    bool ok = false;
    for (int &x : candidate)
      while (x % gcd == 0) x /= gcd, ok = 1;
    if (ok) res = min(res, Calc(gcd));
  }
  for (int gcd : candidate)
    if (gcd != 1) res = min(res, Calc(gcd));
  cout << res;
  return 0;
}
