#include <bits/stdc++.h>
using namespace std;
int a, b;
set<int> trobat;
vector<int> divisors;
void divisor(int n) {
  int i = 2;
  while (i * i <= n) {
    if (n % i == 0) {
      if (not trobat.count(i)) {
        divisors.push_back(i);
        trobat.insert(i);
      }
      n /= i;
    } else
      i++;
  }
  if (n != 1 and not trobat.count(n)) {
    divisors.push_back(n);
    trobat.insert(n);
  }
}
int main() {
  int n;
  cin >> n >> a >> b;
  vector<int> v(n);
  for (int i = 0; i < n; i++) {
    cin >> v[i];
  }
  divisor(v[0] + 1);
  divisor(v[0] - 1);
  divisor(v[0]);
  divisor(v[n - 1]);
  divisor(v[n - 1] + 1);
  divisor(v[n - 1] - 1);
  long long int m = 10000000000000000;
  int primer;
  vector<vector<long long int> > dp(n, vector<long long int>(3, -1));
  for (int i = 0; i < divisors.size(); i++) {
    primer = divisors[i];
    if (v[0] % primer == 0) {
      dp[0][0] = 0;
      dp[0][1] = 0;
      dp[0][2] = 0;
    } else if ((v[0] + 1) % primer == 0 or (v[0] - 1) % primer == 0) {
      dp[0][0] = min(a, b);
      dp[0][1] = min(a, b);
      dp[0][2] = b;
    } else {
      dp[0][0] = a;
      dp[0][1] = a;
      dp[0][2] = 10000000000000000;
    }
    for (int k = 1; k < n; k++) {
      for (int j = 0; j < 3; j++) {
        if (j == 0) {
          if (v[k] % primer == 0) {
            dp[k][0] = dp[k - 1][0];
          } else if ((v[k] + 1) % primer == 0 or (v[k] - 1) % primer == 0) {
            dp[k][0] = min(b + dp[k - 1][0], a + dp[k - 1][1]);
          } else
            dp[k][0] = a + dp[k - 1][1];
        }
        if (j == 1) {
          if (v[k] % primer == 0) {
            dp[k][1] = min(a + dp[k - 1][1], dp[k - 1][2]);
          } else if ((v[k] + 1) % primer == 0 or (v[k] - 1) % primer == 0) {
            dp[k][1] = min(b + dp[k - 1][2], a + dp[k - 1][1]);
          } else
            dp[k][1] = a + dp[k - 1][1];
        }
        if (j == 2) {
          if (v[k] % primer == 0) {
            dp[k][2] = dp[k - 1][2];
          } else if ((v[k] + 1) % primer == 0 or (v[k] - 1) % primer == 0) {
            dp[k][2] = b + dp[k - 1][2];
          } else
            dp[k][2] = 10000000000000000;
        }
      }
    }
    m = min(m, dp[n - 1][0]);
  }
  cout << m << endl;
}
