#include <bits/stdc++.h>
using namespace std;
long long a, b, c, d;
int m[1000001];
long long n[1000001];
bool f = 0;
long long solve(long long d) {
  long long ans = 0;
  int mix = 1E9, maxx = -1;
  for (int i = 1; i < a; ++i)
    if (m[i] % d == 0)
      n[i] = -b;
    else if ((m[i] + 1) % d == 0 || (m[i] - 1) % d == 0)
      n[i] = c - b, ans += c;
    else
      n[i] = -b, mix = min(mix, i), maxx = max(maxx, i);
  long long max_ = 0;
  if (maxx != -1) {
    for (int i = mix; i <= maxx; ++i) max_ += n[i];
    long long max__ = 0;
    if (mix != 1) max__ = max(max__, n[mix - 1]);
    for (int i = mix - 2; i > 0; --i) {
      n[i] += n[i + 1];
      max__ = max(max__, n[i]);
    }
    max_ += max__;
    max__ = 0;
    if (maxx < a - 1) max__ = max(max__, n[maxx + 1]);
    for (int i = maxx + 2; i < a; ++i) {
      n[i] += n[i - 1];
      max__ = max(max__, n[i]);
    }
    max_ += max__;
  } else {
    for (int i = 2; i < a; ++i) n[i] += n[i - 1];
    long long min_ = 0;
    for (int i = 1; i < a; ++i) {
      max_ = max(max_, n[i] - min_);
      min_ = min(min_, n[i]);
    }
  }
  ans -= max_;
  return ans;
}
long long solve() {
  vector<int> v;
  int d = m[0];
  for (int i = 2; i * i <= d; ++i)
    while (d % i == 0) v.push_back(i), d /= i;
  if (d != 1) v.push_back(d);
  long long min_ = 1E18;
  v.resize(unique(v.begin(), v.end()) - v.begin());
  for (int i = 0; i < v.size(); ++i) min_ = min(min_, solve(v[i]));
  return min_;
}
int main() {
  cin >> a;
  cin >> b >> c;
  for (int i = 0; i < a; ++i) scanf("%d", &m[i]);
  long long min_ = 1E18;
  for (int i = 0; i < 2; ++i) {
    min_ = min(min_, solve());
    ++m[0];
    min_ = min(min_, solve() + c);
    m[0] -= 2;
    min_ = min(min_, solve() + c);
    m[0]++;
    reverse(m, m + a);
  }
  cout << min_ << "\n";
  return 0;
}
