#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, x, y, cost = 0, i;
  cin >> n >> x >> y;
  int a[n];
  for (i = 0; i < n; ++i) cin >> a[i];
  for (int i = 0; i < n / 2; ++i) {
    if (a[i] != a[n - 1 - i] && !((a[i] == 2) || (a[n - 1 - i] == 2))) {
      cout << "-1";
      return 0;
    }
  }
  for (i = 0; i < n / 2; ++i) {
    if (a[i] == 2) {
      if (a[n - 1 - i] == 0)
        cost += x;
      else if (a[n - 1 - i] == 1)
        cost += y;
      else if (a[n - 1 - i] == 2)
        cost += min(x, y);
    }
    if (a[n - 1 - i] == 2) {
      if (a[i] == 0)
        cost += x;
      else if (a[i] == 1)
        cost += y;
      else if (a[i] == 2)
        cost += min(x, y);
    }
  }
  if (n % 2 == 1 && a[n / 2] == 2) {
    cost += min(x, y);
  }
  cout << cost;
  return 0;
}
