#include <bits/stdc++.h>
using namespace std;
long long const delta = 1000000007;
int main() {
  std::ios::sync_with_stdio(0);
  ;
  cin.tie(0);
  cout.tie(0);
  long long n, aa, b;
  cin >> n >> aa >> b;
  long long ans = 0;
  long long a[n];
  for (long long i = 0; i < n; i++) {
    cin >> a[i];
  }
  long long i = 0, j = n - 1;
  while (j >= i) {
    if (a[i] != a[j] && a[i] != 2 && a[j] != 2) return cout << -1, 0;
    if (a[i] == a[j] && a[i] == 2) {
      if (i != j)
        ans += (2 * min(aa, b));
      else
        ans += (min(aa, b));
    } else if (a[i] != a[j] && (a[i] == 1 || a[j] == 1)) {
      ans += b;
    } else if (a[i] != a[j]) {
      ans += aa;
    }
    i++;
    j--;
  }
  cout << ans;
  return 0;
}
