#include <bits/stdc++.h>
using namespace std;
const int N = 1e6 + 5;
int n, c1, c2, a[N];
long long dp[N][3], ans = (long long)1e18;
vector<int> v;
void f(int first) {
  for (int i = 2; i * i <= first; ++i)
    if (first % i == 0) {
      v.push_back(i);
      while (first % i == 0) first /= i;
    }
  if (first > 1) v.push_back(first);
}
int main() {
  ios_base::sync_with_stdio(0);
  cin >> n >> c1 >> c2;
  for (int i = 1; i <= n; ++i) cin >> a[i];
  f(a[1]);
  f(a[1] - 1);
  f(a[1] + 1);
  f(a[n]);
  f(a[n] - 1);
  f(a[n] + 1);
  sort((v).begin(), (v).end());
  vector<int> z;
  z.push_back(v[0]);
  for (int i = 1; i < v.size(); ++i)
    if (v[i] != v[i - 1]) z.push_back(v[i]);
  v = z;
  for (int i = 0; i < v.size(); ++i) {
    for (int j = 1; j <= n; ++j) {
      dp[j][0] = dp[j][1] = dp[j][2] = (long long)1e18;
      if (a[j] % v[i] == 0) {
        dp[j][0] = min(dp[j][0], dp[j - 1][0]);
        dp[j][2] = min(dp[j][2], dp[j - 1][2]);
        dp[j][2] = min(dp[j][2], dp[j - 1][1]);
      }
      if ((a[j] - 1) % v[i] == 0 || (a[j] + 1) % v[i] == 0) {
        dp[j][0] = min(dp[j][0], dp[j - 1][0] + c2);
        dp[j][2] = min(dp[j][2], dp[j - 1][1] + c2);
        dp[j][2] = min(dp[j][2], dp[j - 1][2] + c2);
      }
      dp[j][1] = min(dp[j][1], min(dp[j - 1][0], dp[j - 1][1]) + c1);
    }
    ans = min(ans, min(dp[n][0], min(dp[n][1], dp[n][2])));
  }
  cout << ans;
}
