#include <bits/stdc++.h>
using namespace std;
signed main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int n;
  long long cw, cb, ans = 0;
  cin >> n >> cw >> cb;
  vector<int> a(n);
  for (int i = 0; i < n; i++) cin >> a[i];
  for (int i = 0; i < n / 2; i++) {
    if ((a[i] != 2) && (a[n - 1 - i] != 2) && (a[i] != a[n - 1 - i])) {
      cout << -1;
      return 0;
    }
    if ((a[i] != 2) && (a[n - 1 - i] != 2)) {
      continue;
    }
    if ((a[i] == 2) && (a[n - 1 - i] == 2)) {
      ans += 2 * min(cw, cb);
      continue;
    }
    if ((a[i] == 0) || (a[n - 1 - i] == 0)) {
      ans += cw;
      continue;
    }
    ans += cb;
  }
  if ((n % 2) && (a[n / 2] == 2)) ans += min(cw, cb);
  cout << ans;
  return 0;
}
