#include <bits/stdc++.h>
using namespace std;
void deb(long long int n) { cout << "ok" << n << endl; }
void soln() {
  long long int n, a, b;
  cin >> n >> a >> b;
  vector<long long int> v(n);
  for (long long int i = 0; i < n; i++) {
    cin >> v[i];
  }
  long long int m = min(a, b);
  long long int cost = 0, f = 0;
  if (m == a) {
    f = 0;
  }
  if (m == b) {
    f = 1;
  }
  long long int l = 0, r = n - 1;
  while (r >= l) {
    if ((v[l] != 2 and v[r] != 2) and v[l] != v[r]) {
      cout << -1;
      return;
    } else if ((v[l] == 2 or v[r] == 2)) {
      if (v[l] == 2 and v[r] == 2) {
        if (l != r) {
          cost += (2 * m);
        } else {
          cost += (1 * m);
        }
      }
      if ((v[l] == 2 and v[r] != 2) or (v[r] == 2 and v[l] != 2)) {
        if (v[l] == 2 and v[r] != 2) {
          if (v[r] == 0) {
            cost += a;
          } else {
            cost += b;
          }
        }
        if (v[r] == 2 and v[l] != 2) {
          if (v[l] == 0) {
            cost += a;
          } else {
            cost += b;
          }
        }
      }
    }
    l++;
    r--;
  }
  cout << cost;
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long int t;
  t = 1;
  long long int i = 1;
  while (t--) {
    soln();
    i++;
  }
  return 0;
}
