#include <bits/stdc++.h>
using namespace std;
int mi(int a, int b) {
  if (a > b) return b;
  return a;
}
int v[50];
int main() {
  int n, a, b, sum = 0;
  bool ok;
  cin >> n >> a >> b;
  if (a > b)
    ok = 1;
  else
    ok = 0;
  for (int i = 1; i <= n; i++) {
    cin >> v[i];
  }
  for (int i = 1; i <= n / 2; i++) {
    if (v[i] == 1 and v[n - i + 1] == 1) {
      continue;
    }
    if (v[i] == 0 and v[n - i + 1] == 0) {
      continue;
    }
    if (v[i] == 0 and v[n - i + 1] == 1) {
      cout << -1;
      return 0;
    }
    if (v[i] == 1 and v[n - i + 1] == 0) {
      cout << -1;
      return 0;
    }
    if (v[i] == 1 or v[n - i + 1] == 1) {
      sum += b;
    } else if (v[i] == 0 or v[n - i + 1] == 0)
      sum += a;
    else
      sum += mi(a, b) * 2;
  }
  if (n % 2 == 1) {
    if (v[n / 2 + 1] == 2) sum += mi(a, b);
  }
  cout << sum;
  return 0;
}
