#include <bits/stdc++.h>
using namespace std;
long long n, a, b;
long long x[1000010];
vector<long long> primes;
long long answ = 1000000000000000007;
void fact(long long d) {
  for (long long i = 2; i * i <= d; ++i) {
    if (!(d % i)) {
      primes.push_back(i);
      while (!(d % i)) d /= i;
    }
  }
  if (d != 1) primes.push_back(d);
}
long long dp[1000010][3];
long long p[1000010];
bool u[1000010];
bool vl;
void init(long long g) {
  for (register long long i = 0; i < n; ++i) {
    p[i] = 0ll, u[i] = false;
    if (x[i] % g) {
      if (!((x[i] + 1) % g))
        p[i] = b;
      else if (!((x[i] - 1) % g))
        p[i] = b;
      else
        p[i] = a, u[i] = true;
    }
  }
}
void comp(bool vl) {
  for (register long long i = 1; i < n; ++i) {
    if (u[i]) {
      dp[i][0] = 1000000000000000007;
      dp[i][1] = (vl ? dp[i - 1][1] : min(dp[i - 1][1], dp[i - 1][0])) + a;
      dp[i][2] = (vl ? dp[i][1] : min(dp[i - 1][2] + p[i], dp[i][1]));
      vl = true;
    } else {
      dp[i][0] = (vl ? 1000000000000000007 : (dp[i - 1][0] + p[i]));
      dp[i][1] = (vl ? dp[i - 1][1] : min(dp[i - 1][1], dp[i - 1][0])) + a;
      dp[i][2] = min(dp[i - 1][2] + p[i], dp[i][1]);
    }
  }
}
long long get_price(long long g) {
  long long ta = 1000000000000000007;
  init(g);
  bool vl = false;
  if (u[0])
    dp[0][0] = 1000000000000000007, vl = true;
  else
    dp[0][0] = p[0];
  dp[0][1] = a;
  dp[0][2] = a;
  comp(vl);
  if (u[0])
    ta = dp[n - 2][2] + p[n - 1];
  else
    ta = min(dp[n - 1][0], dp[n - 1][2]);
  return ta;
}
int main() {
  scanf("%I64d %I64d %I64d", &n, &a, &b);
  for (register long long i = 0; i < n; ++i) scanf("%I64d", x + i);
  fact(x[0]), fact(x[n - 1]);
  fact(max(x[0] - 1, 1ll)), fact(max(x[n - 1] - 1, 1ll));
  fact(x[0] + 1), fact(x[n - 1] + 1);
  sort(primes.begin(), primes.end());
  primes.resize(unique(primes.begin(), primes.end()) - primes.begin());
  for (const auto& v : primes) answ = min(answ, get_price(v));
  printf("%I64d\n", answ);
  return 0;
}
