#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int n, a, b;
  cin >> n >> a >> b;
  int ar[n];
  for (int i = 0; i < n; i++) {
    cin >> ar[i];
  }
  int ans = 0;
  for (int i = 0; i < n / 2; i++) {
    int pos = n - i - 1;
    if (ar[i] == ar[pos]) {
      if (ar[i] == 2) ans += 2 * min(a, b);
    } else if (ar[i] == 2) {
      if (ar[pos] == 0)
        ans += a;
      else
        ans += b;
    } else if (ar[pos] == 2) {
      if (ar[i] == 0)
        ans += a;
      else
        ans += b;
    } else {
      cout << -1 << endl;
      return 0;
    }
  }
  if (n % 2 == 1 && ar[n / 2] == 2) ans += min(a, b);
  cout << ans << endl;
  return 0;
}
