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