#include <bits/stdc++.h>
using namespace std;
int N;
long long A, B;
long long arr[1100000];
set<long long> pri;
long long ans = 1000000000000000001ll;
void genprime(long long u) {
  if (u == 1ll) {
    return;
  }
  int x = (int)(sqrt(u));
  for (long long i = 2; i <= x; i++) {
    if (u % i == 0) {
      pri.insert(i);
      while (u % i == 0) {
        u /= i;
      }
    }
  }
  if (u > 1) {
    pri.insert(u);
  }
  return;
}
long long cost(long long p) {
  long long a = 0, b = 0, c = 0;
  for (int i = 0; i < N; i++) {
    if (arr[i] % p == 0ll) {
      b += A;
    } else if ((arr[i] - 1) % p == 0ll || (arr[i] + 1) % p == 0ll) {
      a += B;
      c += B;
      b += A;
    } else {
      a += 1000000000000000001ll;
      c += 1000000000000000001ll;
      b += A;
    }
    a = min(a, 1000000000000000001ll);
    b = min(b, a);
    c = min(c, b);
  }
  return c;
}
int readint() {
  char c = ' ';
  while (c < '0') {
    c = getchar();
  }
  int res = 0;
  while (c >= '0') {
    res = 10 * res + c - '0';
    c = getchar();
  }
  return res;
}
long long readll() {
  char c = ' ';
  while (c < '0') {
    c = getchar();
  }
  long long res = 0;
  while (c >= '0') {
    res = 10 * res + c - '0';
    c = getchar();
  }
  return res;
}
int32_t main() {
  if (fopen("cf624d.in", "r")) {
    freopen("cf624d.in", "r", stdin);
    freopen("cf624d.out", "w", stdout);
  }
  N = readint();
  A = readll();
  B = readll();
  for (int i = 0; i < N; i++) {
    arr[i] = readll();
  }
  genprime(arr[0]);
  genprime(arr[0] - 1);
  genprime(arr[0] + 1);
  genprime(arr[N - 1]);
  genprime(arr[N - 1] - 1);
  genprime(arr[N - 1] + 1);
  for (set<long long>::iterator it = pri.begin(); it != pri.end(); it++) {
    long long p = *it;
    ans = min(ans, cost(p));
  }
  cout << ans << '\n';
  return 0;
}
