#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(false);
  int n;
  cin >> n;
  int w, b;
  cin >> w >> b;
  vector<int> ve;
  for (int i = 0; i < n; i++) {
    int x;
    cin >> x;
    ve.push_back(x);
  }
  int res = 0;
  for (int i = 0, j = n - 1; i <= j; i++, j--) {
    if (ve[i] == ve[j] && ve[i] == 2) {
      res += (i == j ? 1 : 2) * min(w, b);
    } else if (ve[i] == ve[j])
      continue;
    else if (ve[i] != ve[j]) {
      if (ve[i] == 2)
        res += (ve[j] == 0 ? w : b);
      else if (ve[j] == 2)
        res += (ve[i] == 0 ? w : b);
      else {
        cout << -1 << endl;
        return 0;
      }
    }
  }
  cout << res << endl;
  return 0;
}
