#include <bits/stdc++.h>
using namespace std;
vector<long long int> v;
long long int dp[1000002][3];
bool val[40002];
set<long long int> s;
void get(long long int z) {
  long long int i, p;
  bool f = false;
  p = v.size();
  for (i = 0; i < p; i++) {
    f = false;
    while (z % v[i] == 0) {
      z = z / v[i];
      f = true;
    }
    if (f == true) s.insert(v[i]);
    if (z != 1) s.insert(z);
  }
}
int main() {
  long long int a, b, c, d = 1e18, e, i, j, p, q, t = 1e18;
  long long int y[1000002];
  cin >> a >> b >> c;
  for (i = 1; i <= a; i++) {
    scanf("%lld", &y[i]);
  }
  for (i = 2; i <= 40000; i++) {
    if (val[i]) continue;
    v.push_back(i);
    for (j = i; j <= 40000; j = j + i) val[j] = false;
  }
  get(y[1]);
  get(y[1] - 1);
  get(y[1] + 1);
  get(y[a]);
  get(y[a] + 1);
  get(y[a] - 1);
  q = s.size();
  for (set<long long int>::iterator it = s.begin(); it != s.end(); it++) {
    e = *it;
    if (y[1] % e == 0) {
      dp[1][0] = 0;
    } else if ((y[1] + 1) % e == 0) {
      dp[1][0] = c;
    } else if ((y[1] - 1) % e == 0) {
      dp[1][0] = c;
    } else
      dp[1][0] = t;
    dp[1][1] = b;
    dp[1][2] = b;
    for (i = 2; i <= a; i++) {
      if (y[i] % e == 0) {
        dp[i][0] = dp[i - 1][0];
        dp[i][1] = min(dp[i - 1][0], dp[i - 1][1]) + b;
        dp[i][2] = min(dp[i][1], dp[i - 1][2]);
      } else if (((y[i] - 1) % e == 0) || ((y[i] + 1) % e == 0)) {
        dp[i][0] = dp[i - 1][0] + c;
        dp[i][1] = min(dp[i - 1][0], dp[i - 1][1]) + b;
        dp[i][2] = min(dp[i][1], dp[i - 1][2] + c);
      } else {
        dp[i][0] = t;
        dp[i][1] = dp[i][1] = min(dp[i - 1][0], dp[i - 1][1]) + b;
        dp[i][2] = dp[i][1];
      }
    }
    d = min(d, dp[a][0]);
    d = min(d, dp[a][1]);
    d = min(d, dp[a][2]);
  }
  cout << d;
  return 0;
}
