#include <bits/stdc++.h>
using namespace std;
long long solve(vector<long long> &v, long long a, long long b,
                long long target) {
  long long n = v.size();
  long long left = n + 1, right = -1;
  long long ret = 0;
  for (long long i = 0; i < v.size(); ++i) {
    if (v[i] % target) {
      if (((v[i] - 1) % target) && ((v[i] + 1) % target)) {
        left = min(left, i);
        right = max(right, i);
      } else {
        ret += b;
      }
    } else {
    }
  }
  if (left == n + 1) {
    long long mnCost = 0;
    long long sum = 0;
    for (int i = 1; i < v.size(); ++i) {
      if (v[i] % target) {
        sum += a - b;
      } else {
        sum += a;
      }
      if (sum < mnCost) mnCost = sum;
      if (sum > 0) sum = 0;
    }
    sum = 0;
    for (int i = 0; i < v.size() - 1; ++i) {
      if (v[i] % target) {
        sum += a - b;
      } else {
        sum += a;
      }
      if (sum < mnCost) mnCost = sum;
      if (sum > 0) sum = 0;
    }
    return ret + mnCost;
  } else {
    ret += a * (right - left + 1);
    for (int i = left; i <= right; ++i) {
      if (v[i] % target) {
        if (((v[i] - 1) % target) && ((v[i] + 1) % target)) {
        } else {
          ret -= b;
        }
      } else {
      }
    }
    long long extLeft = 0;
    long long mnLeft = 0;
    long long extRight = 0;
    long long mnRight = 0;
    long long mnLeftJB = 0;
    long long mnRightJB = 0;
    for (int i = left - 1; i >= 0; --i) {
      extLeft += a;
      if (v[i] % target) extLeft -= b;
      if (extLeft < mnLeft) {
        mnLeft = extLeft;
        if (i) mnLeftJB = mnLeft;
      }
    }
    for (int i = right + 1; i < n; ++i) {
      extRight += a;
      if (v[i] % target) extRight -= b;
      if (extRight < mnRight) {
        mnRight = extRight;
        if (i + 1 < n) {
          mnRightJB = mnRight;
        }
      }
    }
    return ret + min(mnLeft + mnRightJB, mnLeftJB + mnRight);
  }
}
int main() {
  long long n, a, b;
  ios_base::sync_with_stdio(false);
  cin >> n >> a >> b;
  vector<long long> v(n);
  for (long long i = 0; i < n; ++i) {
    cin >> v[i];
  }
  set<long long> possible;
  for (long long x = v[0] - 1; x <= v[0] + 1; x++) {
    long long tp = x;
    for (long long i = 2; i * i <= tp && tp > 1; ++i) {
      while ((tp % i) == 0) {
        possible.insert(i);
        tp /= i;
      }
    }
    if (tp > 1) possible.insert(tp);
  }
  for (long long x = v[v.size() - 1] - 1; x <= v[v.size() - 1] + 1; x++) {
    long long tp = x;
    for (long long i = 2; i * i <= tp && tp > 1; ++i) {
      while ((tp % i) == 0) {
        possible.insert(i);
        tp /= i;
      }
    }
    if (tp > 1) possible.insert(tp);
  }
  long long realAns = n * max(a, b);
  for (auto target : possible) {
    realAns = min(realAns, solve(v, a, b, target));
  }
  cout << realAns << endl;
  return 0;
}
