#include <bits/stdc++.h>
using namespace std;
long long N, A, B;
long long X[1000010];
long long dp[2][3];
set<long long> PF;
void pf(long long n) {
  int x = 2;
  while (x <= 500000 && n != 1) {
    if (n % x == 0) {
      n /= x;
      PF.insert(x);
    } else {
      x++;
    }
  }
  if (n != 1) PF.insert(n);
}
int main() {
  scanf("%lld%lld%lld", &N, &A, &B);
  for (int i = 1; i <= N; i++) scanf("%lld", &X[i]);
  pf(X[1] - 1);
  pf(X[1]);
  pf(X[1] + 1);
  pf(X[N] - 1);
  pf(X[N]);
  pf(X[N] + 1);
  long long ans = (1ll << 60);
  for (set<long long>::iterator it = PF.begin(); it != PF.end(); it++) {
    long long p = *it;
    dp[0][0] = dp[0][1] = dp[0][2] = 0;
    for (int i = 1; i <= N; i++) {
      int ic = i % 2, ip = 1 - ic;
      if (X[i] % p == 0) {
        dp[ic][0] = dp[ip][0];
        dp[ic][2] = min(dp[ip][1], dp[ip][2]);
      } else if ((X[i] - 1) % p == 0 || (X[i] + 1) % p == 0) {
        dp[ic][0] = dp[ip][0] + B;
        dp[ic][2] = min(dp[ip][1], dp[ip][2]) + B;
      } else {
        dp[ic][0] = (1ll << 60);
        dp[ic][2] = (1ll << 60);
      }
      dp[ic][1] = min(dp[ip][0], dp[ip][1]) + A;
    }
    ans = min(ans, dp[N % 2][0]);
    ans = min(ans, dp[N % 2][1]);
    ans = min(ans, dp[N % 2][2]);
  }
  printf("%lld\n", ans);
  return 0;
}
