#include <bits/stdc++.h>
using namespace std;
const long long sze = 3e5 + 50, INF = 1e18, mod = 1000000007;
const long double eps = 1e-9, PI = 2 * acos(0.0);
template <class T>
void show(const vector<T> &a) {
  for (T x : a) cout << x << " ";
  cout << '\n';
}
vector<long long> vertices[sze];
vector<char> visit(sze, false);
vector<long long> arr(sze, 0);
long long n;
long long m;
long long k;
long long cnt = 0;
string s, t;
long long col[sze];
long long sum[sze];
long long tbl[100][100];
signed main() {
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long a, b;
  cin >> n >> a >> b;
  for (long long i = 0; i < n; i++) {
    cin >> arr[i];
  }
  for (long long i = 0; i < n / 2; i++) {
    if (arr[i] != 2 && arr[n - 1 - i] != 2 && arr[i] != arr[n - 1 - i]) {
      cout << "-1";
      return 0;
    }
    if (arr[i] != 2 && arr[n - 1 - i] != 2 && arr[i] == arr[n - 1 - i]) {
      continue;
    }
    if (arr[i] == 2 && arr[n - 1 - i] == 2) {
      cnt += 2 * min(a, b);
    }
    if (arr[i] == 0 || arr[n - 1 - i] == 0) {
      cnt += a;
    }
    if (arr[i] == 1 || arr[n - 1 - i] == 1) {
      cnt += b;
    }
  }
  if (n & 1 && arr[n / 2] == 2) {
    cnt += min(a, b);
  }
  cout << cnt;
  return 0;
}
