#include <bits/stdc++.h>
using namespace std;
const int INFint = 2e9;
const unsigned long long INF = 1e18;
const int MOD = 1e9 + 7;
set<int> all;
vector<int> v;
unsigned long long a, b;
void factorize(int x) {
  vector<int> cur;
  for (int d = 2; 1ll * d * d <= x; d += 1 + (d != 2)) {
    if (x % d == 0) {
      cur.push_back(d);
      while (x % d == 0) x /= d;
    }
  }
  if (x > 1) all.insert(x);
  all.insert(cur.begin(), cur.end());
}
unsigned long long price(int x, int p) {
  int r = min(x % p, p - x % p);
  if (r > 1) return INF;
  return b * r;
}
unsigned long long solve(int p) {
  int n = v.size();
  vector<vector<unsigned long long> > dp(n, vector<unsigned long long>(3, INF));
  dp[0][0] = price(v[0], p);
  dp[0][1] = a;
  for (int i = 1; i < n; i++) {
    dp[i][0] = dp[i - 1][0] + price(v[i], p);
    dp[i][1] = min(dp[i - 1][0], dp[i - 1][1]) + a;
    dp[i][2] = min(dp[i - 1][1], dp[i - 1][2]) + price(v[i], p);
    dp[i][0] = min(dp[i][0], INF);
    dp[i][1] = min(dp[i][1], INF);
    dp[i][2] = min(dp[i][2], INF);
  }
  return min(dp[n - 1][0], min(dp[n - 1][1], dp[n - 1][2]));
}
int main() {
  ios_base::sync_with_stdio(0);
  int n;
  cin >> n >> a >> b;
  v.resize(n);
  for (auto &x : v) cin >> x;
  for (int d = -1; d < 2; d++) {
    factorize(v[0] + d);
    factorize(v.back() + d);
  }
  vector<int> cur(all.begin(), all.end());
  unsigned long long ans = INF;
  for (auto p : cur) {
    ans = min(ans, solve(p));
  }
  cout << ans;
  fprintf(stderr, "\nTIME = %lf\n", 1.0 * clock() / CLOCKS_PER_SEC);
  ;
  return 0;
}
