#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long n, b, w;
  cin >> n >> w >> b;
  long long c = min(b, w);
  long long ar[n], tot = 0;
  for (int i = 0; i < n; i++) cin >> ar[i];
  long long i = 0;
  long long j = n - 1;
  while (i <= j) {
    if (ar[i] != ar[j]) {
      if ((ar[i] == 2 && ar[j] == 0) || (ar[i] == 0 && ar[j] == 2))
        tot += w;
      else if ((ar[i] == 2 && ar[j] == 1) || (ar[i] == 1 && ar[j] == 2))
        tot += b;
      else if (ar[i] != 2 && ar[j] != 2) {
        cout << "-1";
        return 0;
      }
    } else if (ar[i] == 2 && ar[j] == 2 && i != j)
      tot += 2 * c;
    else if (ar[i] == 2 && ar[j] == 2 && i == j)
      tot += c;
    i++;
    j--;
  }
  cout << tot;
}
