#include <bits/stdc++.h>
using namespace std;
const int SEED = chrono::steady_clock::now().time_since_epoch().count();
mt19937 rng(SEED);
void test_case() {
  int n, a, b;
  cin >> n >> a >> b;
  vector<int> v(n);
  for (auto &x : v) cin >> x;
  int ans = 0;
  for (int i = 0; i < n; i++) {
    if (v[i] == 0 && v[n - i - 1] == 1) {
      cout << -1 << endl;
      return;
    }
    if (v[i] == 2) {
      if (v[n - 1 - i] == 0) ans += a;
      if (v[n - 1 - i] == 1) ans += b;
      if (v[n - 1 - i] == 2) ans += min(a, b);
    }
  }
  cout << ans << endl;
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  int t = 1;
  for (int i = 1; i <= t; i++) {
    test_case();
  }
  return 0;
}
