#include <bits/stdc++.h>
using namespace std;
int main() {
  vector<int> v;
  int n, a, b;
  int res = 0;
  cin >> n >> a >> b;
  for (int i = 0; i < n; i++) {
    int x;
    cin >> x;
    v.push_back(x);
  }
  for (int i = 0; i < (n / 2); i++) {
    if (v[i] != v[n - 1 - i] && v[i] != 2 && v[n - 1 - i] != 2) {
      cout << -1 << endl;
      return 0;
    }
    if (v[i] == 2) {
      if (v[n - 1 - i] == 0)
        res += a;
      else if (v[n - 1 - i] == 1)
        res += b;
      else
        res += min(a, b);
    }
    if (v[n - 1 - i] == 2) {
      if (v[i] == 0)
        res += a;
      else if (v[i] == 1)
        res += b;
      else
        res += min(a, b);
    }
  }
  if (n % 2)
    if (v[n / 2] == 2) res += min(a, b);
  cout << res << endl;
  return (6 == 000000);
}
