#include <bits/stdc++.h>
using namespace std;
const int N = 1e6 + 10;
const long long inf = 1e18 + 10;
long long a[N], dp[N][3], n, x, y, ans;
void check(long long p, long long f) {
  memset(dp, 63, sizeof dp);
  if (a[0] % p == 0)
    dp[0][0] = dp[0][2] = 0;
  else if (a[0] % p == 1 || a[0] % p == p - 1)
    dp[0][0] = dp[0][2] = y;
  else
    dp[0][0] = dp[0][2] = inf;
  if (!f)
    dp[0][1] = inf;
  else
    dp[0][1] = x;
  for (long long i = 1; i < n; i++) {
    if (a[i] % p == 0) {
      dp[i][0] = dp[i - 1][0];
      dp[i][2] = min({dp[i - 1][0], dp[i - 1][1], dp[i - 1][2]});
    } else if (a[i] % p == 1 || a[i] % p == p - 1) {
      dp[i][0] = dp[i - 1][0] + y;
      dp[i][2] = min({dp[i - 1][0], dp[i - 1][1], dp[i - 1][2]}) + y;
    } else {
      dp[i][0] = inf;
      dp[i][2] = inf;
    }
    dp[i][1] = min({dp[i - 1][0], dp[i - 1][1]}) + x;
  }
  if (f) dp[n - 1][1] = inf;
  ans = min({ans, dp[n - 1][0], dp[n - 1][1], dp[n - 1][2]});
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> n >> x >> y;
  for (long long i = 0; i < n; i++) cin >> a[i];
  ans = inf;
  long long k = a[0];
  for (long long i = 2; i * i <= a[0]; i++) {
    if (k % i == 0) {
      check(i, 0);
      while (k % i == 0) k /= i;
    }
  }
  if (k != 1) check(k, 0);
  k = a[0] + 1;
  for (long long i = 2; i * i <= a[0] + 1; i++) {
    if (k % i == 0) {
      check(i, 0);
      while (k % i == 0) k /= i;
    }
  }
  if (k != 1) check(k, 0);
  k = a[0] - 1;
  for (long long i = 2; i * i <= a[0] - 1; i++) {
    if (k % i == 0) {
      check(i, 0);
      while (k % i == 0) k /= i;
    }
  }
  if (k != 1) check(k, 0);
  k = a[n - 1];
  for (long long i = 2; i * i <= a[n - 1]; i++) {
    if (k % i == 0) {
      check(i, 1);
      while (k % i == 0) k /= i;
    }
  }
  if (k != 1) check(k, 1);
  k = a[n - 1] + 1;
  for (long long i = 2; i * i <= a[n - 1] + 1; i++) {
    if (k % i == 0) {
      check(i, 1);
      while (k % i == 0) k /= i;
    }
  }
  if (k != 1) check(k, 1);
  k = a[n - 1] - 1;
  for (long long i = 2; i * i <= a[n - 1] - 1; i++) {
    if (k % i == 0) {
      check(i, 1);
      while (k % i == 0) k /= i;
    }
  }
  if (k != 1) check(k, 1);
  cout << ans;
  return 0;
}
