#include <bits/stdc++.h>
unsigned A[1111111], P[1111], Pi;
void G(unsigned n) {
  unsigned i;
  for (i = -1; ++i < Pi;)
    if (P[i] == n) return;
  P[Pi++] = n;
  return;
}
void F(unsigned n) {
  unsigned i;
  for (i = 2; i * i <= n; ++i)
    if (n % i == 0)
      for (G(i); (n /= i) % i == 0;)
        ;
  if (n > 1) G(n);
  return;
}
unsigned L[1111111], R[1111111], Li, Ri;
int main() {
  unsigned n, a, b, i, j, k, l, r;
  long long unsigned ans = 0, tmp, min, Z;
  --ans;
  scanf("%u%u%u", &n, &a, &b);
  for (i = -1; ++i < n; scanf("%u", A + i))
    ;
  F(A[0] - 1);
  F(A[n - 1] - 1);
  F(A[0]);
  F(A[n - 1]);
  F(A[0] + 1);
  F(A[n - 1] + 1);
  while (Pi--) {
    k = P[Pi];
    Li = Ri = 0;
    for (l = -1; ++l < n;)
      if (A[l] % k) {
        if ((A[l] - 1) % k && (A[l] + 1) % k) break;
        L[Li++] = l;
      }
    if (l == n) {
      if (!Li) {
        ans = 0;
        break;
      }
      min = Li * (long long unsigned)b;
      if (b > a) min -= b - a;
      tmp = min;
      for (i = j = 0; ++i < Li;) {
        if ((tmp += (L[i] - L[i - 1]) * (long long unsigned)a - b) > min)
          tmp = min;
        if (ans > tmp) ans = tmp;
      }
      if (ans > min) ans = min;
      continue;
    }
    for (r = n; r--;)
      if (A[r] % k) {
        if ((A[r] - 1) % k && (A[r] + 1) % k) break;
        R[Ri++] = r;
      }
    tmp = min =
        (Li + Ri) * (long long unsigned)b + (r - l + 1) * (long long unsigned)a;
    for (i = Ri; i--;)
      if (min > (Z = tmp + (R[i] - r) * (long long unsigned)a -
                     (Ri - i) * (long long unsigned)b))
        min = Z;
    tmp = min;
    for (i = Li; i--;)
      if (min > (Z = tmp + (l - L[i]) * (long long unsigned)a -
                     (Li - i) * (long long unsigned)b))
        min = Z;
    if (ans > min) ans = min;
  }
  printf("%I64u\n", ans);
  return 0;
}
