#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  int n, a, b, x;
  vector<int> v;
  cin >> n >> a >> b;
  for (int i = 1; i <= n; i++) {
    cin >> x;
    v.push_back(x);
  }
  int sum = 0;
  for (int i = 0; i < n; i++) {
    if (n % 2 == 1 && i == n / 2 && v[i] == 2) {
      v[n / 2] = -1;
      sum += min(a, b);
    }
    if ((v[i] == 0 && v[n - i - 1] == 1) || (v[i] == 1 && v[n - i - 1] == 0)) {
      cout << -1;
      return 0;
    } else if ((v[i] == 0 && v[n - i - 1] == 2) ||
               (v[i] == 2 && v[n - i - 1] == 0)) {
      v[i] = -1;
      v[n - i - 1] = -1;
      sum += a;
    } else if ((v[i] == 1 && v[n - i - 1] == 2) ||
               (v[i] == 2 && v[n - i - 1] == 1)) {
      v[i] = -1;
      v[n - i - 1] = -1;
      sum += b;
    } else if (v[i] == 2 && v[n - i - 1] == 2) {
      v[i] = -1;
      v[n - i - 1] = -1;
      sum += 2 * min(a, b);
    }
  }
  cout << sum;
}
