#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, w_c, b_c;
  int cost = 0;
  cin >> n >> w_c >> b_c;
  int a[n];
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  for (int i = 0; i < n / 2; i++) {
    if ((a[i] != a[n - 1 - i]) and (a[i] != 2 and a[n - 1 - i] != 2)) {
      cout << -1;
      return 0;
    }
  }
  for (int i = 0; i < n / 2; i++) {
    if (a[i] == 2 and a[n - 1 - i] == 2) {
      cost += 2 * min(w_c, b_c);
      continue;
    }
    if ((a[i] == 0 or a[n - 1 - i] == 0) and (a[i] == 2 or a[n - 1 - i] == 2)) {
      cost += w_c;
      continue;
    }
    if ((a[i] == 1 or a[n - 1 - i] == 1) and (a[i] == 2 or a[n - 1 - i] == 2)) {
      cost += b_c;
    }
  }
  if (n % 2 != 0 and a[n / 2] == 2) {
    cost += min(w_c, b_c);
  }
  cout << cost;
}
