#include <bits/stdc++.h>
using namespace std;
long long const MOD = 998244353;
int const MAXN = 100000;
vector<int> grav[MAXN];
int t_in[MAXN];
int t_out[MAXN];
string colors;
vector<pair<int, int>> dfs_order[MAXN];
vector<int> cnt[MAXN];
int depth[MAXN];
int parent[MAXN];
int up[MAXN][20];
int _t = 0;
int max_d = 0;
void dfs(int u, int p = -1, int d = 0) {
  depth[u] = d;
  parent[u] = p;
  t_in[u] = _t++;
  max_d = max(max_d, d);
  dfs_order[d].emplace_back(t_in[u], u);
  for (int v : grav[u]) {
    dfs(v, u, d + 1);
  }
  t_out[u] = _t++;
}
int main() {
  ios_base::sync_with_stdio(false);
  int n;
  cin >> n;
  long long a, b;
  cin >> a >> b;
  vector<int> v(n);
  for (int i = 0; i < n; i++) cin >> v[i];
  vector<int> ds;
  auto f = [&ds](int n) {
    ds.push_back(n);
    for (int i = 2; i * i <= n; i++) {
      if (n % i == 0) {
        ds.push_back(i);
        while (n % i == 0) n /= i;
      }
    }
    if (n != 1) ds.push_back(n);
  };
  f(v[0]);
  f(v[0] - 1);
  f(v[0] + 1);
  f(v.back());
  f(v.back() - 1);
  f(v.back() + 1);
  set<int> ds_s(ds.begin(), ds.end());
  ds = vector<int>(ds_s.begin(), ds_s.end());
  long long res = numeric_limits<long long>::max();
  for (int d : ds) {
    if (d == 1) continue;
    vector<vector<long long>> dp(n, vector<long long>(3, -1));
    if (v[0] % d == 0) {
      dp[0][0] = 0;
    } else if ((v[0] + 1) % d == 0 || (v[0] - 1) % d == 0) {
      dp[0][0] = b;
    }
    dp[0][1] = a;
    dp[0][2] = -1;
    for (int i = 0; i + 1 < n; i++) {
      int n = v[i + 1];
      if (dp[i][0] != -1) {
        if (n % d == 0) {
          dp[i + 1][0] = dp[i][0];
        } else if ((n + 1) % d == 0 || (n - 1) % d == 0) {
          dp[i + 1][0] = dp[i][0] + b;
        }
        dp[i + 1][1] = dp[i][0] + a;
      }
      if (dp[i][1] != -1) {
        if (dp[i + 1][1] == -1 || dp[i + 1][1] > dp[i][1] + a) {
          dp[i + 1][1] = dp[i][1] + a;
        }
        if (n % d == 0) {
          dp[i + 1][2] = dp[i][1];
        } else if ((n + 1) % d == 0 || (n - 1) % d == 0) {
          dp[i + 1][2] = dp[i][1] + b;
        }
      }
      if (dp[i][2] != -1) {
        if (n % d == 0) {
          if (dp[i + 1][2] == -1 || dp[i + 1][2] > dp[i][2]) {
            dp[i + 1][2] = dp[i][2];
          }
        } else if ((n + 1) % d == 0 || (n - 1) % d == 0) {
          if (dp[i + 1][2] == -1 || dp[i + 1][2] > dp[i][2] + b) {
            dp[i + 1][2] = dp[i][2] + b;
          }
        }
      }
    }
    for (int i = 0; i < 3; i++)
      if (dp[n - 1][i] != -1) res = min(res, dp[n - 1][i]);
  }
  cout << res << "\n";
  return 0;
}
