#include <bits/stdc++.h>
using namespace std;
set<long long> pool;
vector<int> mas;
vector<long long> dig;
long long n, a, b;
long long inf = 4611686018427387904LL;
int main() {
  scanf("%I64d%I64d%I64d", &n, &b, &a);
  mas.resize(n);
  for (int i = 0; i < n; ++i) scanf("%d", &mas[i]);
  dig.push_back(mas[0] - 1);
  dig.push_back(mas[0]);
  dig.push_back(mas[0] + 1);
  dig.push_back(mas.back() - 1);
  dig.push_back(mas.back());
  dig.push_back(mas.back() + 1);
  for (int i = 0; i < dig.size(); ++i) {
    for (int j = 2; j * j <= dig[i]; ++j)
      if (dig[i] % j == 0) {
        pool.insert(j);
        while (dig[i] % j == 0) dig[i] /= j;
      }
    if (dig[i] > 1) pool.insert(dig[i]);
    dig[i] = 1;
  }
  long long ans = inf;
  for (auto it = pool.begin(); it != pool.end(); ++it) {
    int gcd = *it;
    vector<vector<long long> > dp(n, vector<long long>(3, inf));
    dp[0][1] = b;
    if (mas[0] % gcd == 0)
      dp[0][0] = 0;
    else if (((mas[0] + 1) % gcd == 0) || ((mas[0] - 1) % gcd == 0))
      dp[0][0] = a;
    for (int i = 1; i < n; ++i) {
      dp[i][1] = min(inf - b, min(dp[i - 1][1], dp[i - 1][0])) + b;
      if (mas[i] % gcd == 0) {
        dp[i][0] = dp[i - 1][0];
        dp[i][2] = min(dp[i - 1][1], dp[i - 1][2]);
      } else if (((mas[i] + 1) % gcd == 0) || ((mas[i] - 1) % gcd == 0)) {
        dp[i][0] = min(inf - a, dp[i - 1][0]) + a;
        dp[i][2] = min(inf - a, min(dp[i - 1][1], dp[i - 1][2])) + a;
      }
    }
    ans = min(ans, min(min(dp[n - 1][0], dp[n - 1][1]), dp[n - 1][2]));
  }
  printf("%I64d", ans);
  return 0;
}
