#include <bits/stdc++.h>
int ___read_tmp;
using namespace std;
unordered_set<int> factor;
void do_factor(int val) {
  for (int i = 2; i * i <= val; i++) {
    if (val % i == 0) {
      do_factor(val / i);
      factor.insert(i);
      return;
    }
  }
  if (val > 1) factor.insert(val);
}
int arr[1001000];
int main() {
  int n, aa, bb;
  scanf("%d %d %d", &n, &aa, &bb);
  long long a = aa, b = bb;
  for (int i = (0); i < (n); i++) {
    scanf("%d", arr + i);
  }
  if (arr[0] > 2) do_factor(arr[0] - 1);
  do_factor(arr[0]);
  do_factor(arr[0] + 1);
  if (arr[n - 1] > 2) do_factor(arr[n - 1] - 1);
  do_factor(arr[n - 1]);
  do_factor(arr[n - 1] + 1);
  long long best_best_res = 2000000000000000LL;
  for (auto(it) = (factor).begin(); (it) != (factor).end(); (it)++) {
    int dv = *it;
    long long max_sum = 0, curr = 0, tmp = 0;
    long long best_res = 0;
    int last_b = -1;
    long long excluded_from = -1, excluded_to = -1;
    for (int i = (0); i < (n); i++) {
      if ((arr[i]) % dv == 0 || (arr[i] + 1) % dv == 0 ||
          (arr[i] - 1) % dv == 0) {
        continue;
      }
      if (excluded_from == -1) excluded_from = i;
      excluded_to = i;
    }
    if (excluded_to >= 0) best_res = (excluded_to - excluded_from + 1LL) * a;
    for (int i = (0); i < (n); i++) {
      if (arr[i] % dv == 0) {
        curr += a;
      } else if ((arr[i] + 1) % dv == 0 || (arr[i] - 1) % dv == 0) {
        tmp += b;
        curr += a - b;
      } else {
        curr += a;
      }
      if (i >= excluded_to) best_res = min(best_res, curr - max_sum);
      if ((excluded_from == -1 || i < excluded_from) && curr > max_sum)
        max_sum = curr;
    }
    if (excluded_to < 0) best_res = min(0LL, best_res);
    best_best_res = min(best_best_res, tmp + best_res);
  }
  printf("%I64d", best_best_res);
  return 0;
}
