#include <bits/stdc++.h>
using namespace std;
const long long mod = 1e9 + 7;
const int inf = 1000000000;
const int maxn = 5000005;
const int maxa = 300005;
long long gcd(long long a, long long b) { return b ? gcd(b, a % b) : a; }
long long powmod(long long a, long long b) {
  long long res = 1;
  a %= mod;
  if (b < 0) return -1;
  for (; b; b >>= 1) {
    if (b & 1) res = res * a % mod;
    a = a * a % mod;
  }
  return res;
}
int INF = 10000000;
clock_t start, finish;
double duration;
long double eps = 1e-10;
int main() {
  ios::sync_with_stdio(0);
  int n, x, y;
  int a[25];
  cin >> n >> x >> y;
  for (int i = 0; i < n; i++) cin >> a[i];
  int minn = min(x, y), ans = 0;
  for (int i = 0; i < n; i++) {
    if (a[i] == a[n - i - 1]) {
      if (a[i] == 2)
        ans += (i == n - i - 1 ? 1 : 2) * minn;
      else
        continue;
      a[i] = a[n - i - 1] = 1;
    } else if (a[i] == 2) {
      if (a[n - i - 1] == 0)
        ans += x;
      else
        ans += y;
      a[i] = a[n - i - 1];
    } else if (a[n - i - 1] == 2) {
      if (a[i] == 0)
        ans += x;
      else
        ans += y;
      a[n - i - 1] = a[i];
    } else
      return 0 * puts("-1");
  }
  cout << ans << endl;
}
