#include <bits/stdc++.h>
using namespace std;
const int MAXN = 20 + 5, INF = 1e9;
int a[MAXN];
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  int n, x, y;
  cin >> n >> x >> y;
  for (int i = int(0); i < int(n); i++) cin >> a[i];
  int cost = 0;
  bool can = true;
  for (int i = int(0); i < int(n / 2); i++) {
    int j = n - i - 1;
    if (a[i] == 2 && a[j] == 2)
      cost += 2 * min(x, y);
    else if (a[i] == 2 || a[j] == 2) {
      if (a[i] == 0 || a[j] == 0)
        cost += x;
      else
        cost += y;
    } else if (a[i] != a[j])
      can = false;
  }
  if (n % 2 && a[n / 2] == 2) cost += min(x, y);
  cout << (can ? cost : -1) << '\n';
  return 0;
}
