#include <bits/stdc++.h>
using namespace std;
const int MOD = 1e9 + 7;
const int N = 100000;
const long long MAX = 1e15;
int a[1000005], prime[100005];
set<int> ss;
bool vis[100005];
int n, c, b, cnt;
set<int>::iterator it;
long long dp[1000005][4], ans;
void prepare() {
  for (int i = 2; i <= N; i++)
    if (!vis[i]) {
      prime[cnt++] = i;
      int j = i * 2;
      while (j <= N) {
        vis[j] = 1;
        j += i;
      }
    }
}
void get(int x) {
  bool f = 0;
  for (int i = 0; i < cnt; i++) {
    f = 0;
    while (x % prime[i] == 0) {
      f = 1;
      x /= prime[i];
    }
    if (f) ss.insert(prime[i]);
  }
  if (x > 1) ss.insert(x);
}
long long DP(int k) {
  for (int i = 1; i <= n; i++)
    for (int j = 0; j <= 3; j++) dp[i][j] = 1e15;
  if (a[1] % k == 0)
    dp[1][0] = 0;
  else if ((a[1] + 1) % k == 0 || (a[1] - 1) % k == 0)
    dp[1][0] = c;
  dp[1][1] = b;
  long long tem = 0;
  for (int i = 2; i <= n; i++) {
    if (a[i] % k == 0)
      dp[i][0] = dp[i - 1][0];
    else if ((a[i] + 1) % k == 0 || (a[i] - 1) % k == 0)
      dp[i][0] = dp[i - 1][0] + c;
    dp[i][1] = dp[i - 1][0] + b;
    dp[i][2] = min(dp[i - 1][1], dp[i - 1][2]) + b;
    tem = min(dp[i - 1][1], dp[i - 1][2]);
    tem = min(dp[i - 1][3], tem);
    if (a[i] % k == 0)
      dp[i][3] = tem;
    else if ((a[i] + 1) % k == 0 || (a[i] - 1) % k == 0)
      dp[i][3] = tem + c;
    dp[i][1] = min(dp[i][1], MAX);
    dp[i][2] = min(dp[i][2], MAX);
    dp[i][0] = min(dp[i][0], MAX);
    dp[i][3] = min(dp[i][3], MAX);
  }
  tem = min(dp[n][0], dp[n][3]);
  if (dp[n][2] != (long long)n * b || c == b) tem = min(tem, dp[n][2]);
  if (dp[n][1] != (long long)n * b || b == c) tem = min(tem, dp[n][1]);
  return tem;
}
void work() {
  ans = 1e15;
  for (it = ss.begin(); it != ss.end(); it++) {
    int k = *it;
    ans = min(ans, DP(k));
  }
}
int gcd(int a, int b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
int main() {
  prepare();
  scanf("%d%d%d", &n, &b, &c);
  for (int i = 1; i <= n; i++) scanf("%d", &a[i]);
  get(a[1] - 1);
  get(a[1] + 1);
  get(a[1]);
  get(a[n] - 1);
  get(a[n] + 1);
  get(a[n]);
  work();
  cout << ans << endl;
}
