#include <bits/stdc++.h>
using namespace std;
const long long MAX = 1e18 + 10;
long long n, a, b;
long long x[1000100], f[1000100], g[1000100];
vector<long long> prime;
bool isprime[1000100];
set<long long> s;
void getPrime() {
  int i, j;
  for (i = 0; i < 1000100; i++) isprime[i] = true;
  isprime[0] = isprime[1] = 0;
  for (i = 2; i < 1000100; i++) {
    if (!isprime[i]) continue;
    for (j = 2 * i; j < 1000100; j += i) isprime[j] = false;
  }
  prime.clear();
  for (i = 2; i < 1000100; i++) prime.push_back(i);
}
long long change(long long a, long long p) {
  if (a % p == 0) return 0;
  if ((a + 1) % p == 0 || (a - 1) % p == 0) return b;
  return -1;
}
long long Solve(long long p) {
  int L = n + 1, R = 0, i, tag = 0;
  long long t, G, res;
  f[0] = 0;
  for (i = 1; i <= n; i++) {
    t = change(x[i], p);
    if (t == -1) {
      L = i;
      tag = 1;
    }
    if (tag)
      f[i] = MAX;
    else
      f[i] = f[i - 1] + t;
  }
  g[n + 1] = 0;
  tag = 0;
  for (i = n; i > 0; i--) {
    t = change(x[i], p);
    if (t == -1) {
      R = i;
      tag = 1;
    }
    if (tag)
      g[i] = MAX;
    else
      g[i] = g[i + 1] + t;
  }
  G = g[n + 1] + (n + 1) * a;
  res = f[n];
  for (i = n; i >= 0; i--) {
    res = min(res, f[i] - (i + 1) * a + G);
    G = min(G, g[i] + i * a);
  }
  return res;
}
void Get(long long a) {
  if (a == 0 || a == 1) return;
  int i, l = prime.size(), t;
  for (i = 0; i < l; i++) {
    t = prime[i];
    if (t * t > a) break;
    while (a % t == 0) {
      if (s.find(t) == s.end()) s.insert(t);
      a /= t;
    }
  }
  if (a > 1) s.insert(a);
}
void Init() {
  s.clear();
  Get(x[1]);
  Get(x[1] + 1);
  Get(x[1] - 1);
  Get(x[n]);
  Get(x[n] + 1);
  Get(x[n] - 1);
}
int main() {
  int i, j;
  long long ans;
  set<long long>::iterator it;
  getPrime();
  scanf("%I64d%I64d%I64d", &n, &a, &b);
  for (i = 1; i <= n; i++) scanf("%I64d", &x[i]);
  Init();
  ans = MAX;
  for (it = s.begin(); it != s.end(); it++) ans = min(ans, Solve(*it));
  printf("%I64d", ans);
  return 0;
}
