#include <bits/stdc++.h>
using namespace std;
void solve() {
  int cost[2];
  int n;
  cin >> n >> cost[0] >> cost[1];
  int a[n];
  for (int i = 0; i < n; i++) cin >> a[i];
  int i = 0, j = n - 1;
  int minm = min(cost[0], cost[1]);
  int min_cost = 0;
  int fl = 0;
  while (i <= j) {
    if (i == j && a[i] == 2) {
      min_cost += minm;
      break;
    } else if (a[i] == 2 && a[j] == 2) {
      min_cost += 2 * minm;
    } else if (a[i] == 2) {
      min_cost += cost[a[j]];
    } else if (a[j] == 2) {
      min_cost += cost[a[i]];
    } else if (a[i] != a[j]) {
      fl = 1;
      break;
    }
    i++;
    j--;
  }
  if (fl == 1) {
    cout << -1 << '\n';
    return;
  } else
    cout << min_cost << '\n';
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int t = 1;
  while (t--) {
    solve();
  }
  return 0;
}
