#include <bits/stdc++.h>
using namespace std;
const int N = 1e6;
const long long INF = 1e16;
int n, a, b, v[2 + N];
long long dp[2 + N][3];
set<int> poss;
set<int> Factorizare(int x) {
  set<int> ans;
  for (int i = 2; i * i <= x; ++i)
    if (x % i == 0) {
      ans.insert(i);
      while (x % i == 0) x /= i;
    }
  if (x > 1) ans.insert(x);
  return ans;
}
void Read() {
  scanf("%d%d%d", &n, &a, &b);
  for (int i = 1; i <= n; ++i) scanf("%d", &v[i]);
}
void Merge(set<int>& A, const set<int>& from) {
  for (auto i : from) A.insert(i);
}
void Init() {
  for (int j = -1; j <= 1; ++j) Merge(poss, Factorizare(v[1] + j));
  for (int j = -1; j <= 1; ++j) Merge(poss, Factorizare(v[n] + j));
}
void Solve() {
  long long ans = INF;
  for (auto x : poss) {
    for (int i = 1; i <= n; ++i)
      for (int j = 0; j < 3; ++j) dp[i][j] = INF;
    for (int i = 1; i <= n; ++i) {
      int nr = v[i];
      if (nr % x == 0 || (nr - 1) % x == 0 || (nr + 1) % x == 0) {
        bool ok = (nr % x);
        dp[i][0] = dp[i - 1][0];
        if (nr % x != 0) dp[i][0] += b * ok;
        dp[i][1] = min(dp[i - 1][0], dp[i - 1][1]) + a;
        dp[i][2] = min(dp[i - 1][1], dp[i - 1][2]) + b * ok;
      } else {
        dp[i][1] = min(dp[i - 1][0], dp[i - 1][1]) + a;
      }
    }
    ans = min(ans, min({dp[n][0], dp[n][1], dp[n][2]}));
  }
  printf("%I64d\n", ans);
}
int main() {
  Read();
  Init();
  Solve();
  return 0;
}
