#include <bits/stdc++.h>
using namespace std;
int n, a, b;
int val[1000005];
vector<int> gcd;
long long ans = (1LL << 60);
void get(int num) {
  for (int i = 2; i * i <= num; i++) {
    if (num % i == 0) {
      gcd.push_back(i);
      while (num % i == 0) num /= i;
    }
  }
  if (num > 1) gcd.push_back(num);
}
long long cal(int x) {
  long long havnt_delet = 0ll, is_deleting = 0ll, hav_done = 0ll;
  for (int i = 1; i <= n; i++) {
    if (val[i] % x == 0) {
      hav_done = min(hav_done, is_deleting);
      is_deleting = min(havnt_delet, is_deleting) + a;
    } else if ((val[i] - 1) % x == 0 || (val[i] + 1) % x == 0) {
      hav_done = min(hav_done, is_deleting) + b;
      is_deleting = min(havnt_delet, is_deleting) + a;
      if (havnt_delet < (1LL << 60)) {
        havnt_delet += b;
      }
    } else {
      is_deleting = min(havnt_delet, is_deleting) + a;
      hav_done = havnt_delet = (1LL << 60);
    }
  }
  return min(havnt_delet, min(is_deleting, hav_done));
}
int main() {
  cin >> n >> a >> b;
  for (int i = 1; i <= n; i++) cin >> val[i];
  for (int i = -1; i <= 1; i++) {
    get(val[1] + i);
    get(val[n] + i);
  }
  gcd.erase(unique(gcd.begin(), gcd.end()), gcd.end());
  for (auto i : gcd) ans = min(ans, cal(i));
  cout << ans;
  return 0;
}
