#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int numN, priceA, priceB;
  vector<long long int> givenForm;
  scanf("%lld%lld%lld", &numN, &priceA, &priceB);
  givenForm.resize(numN);
  for (int i = 0; i < numN; i++) cin >> givenForm[i];
  long long int finalSum = 0;
  bool isPossible = true;
  long long int minPrice = min(priceA, priceB);
  long long int mid = numN / 2;
  for (int i = 0, j = numN - 1; i <= mid, j >= mid; i++, j--) {
    if (givenForm[i] == givenForm[j]) {
      if (givenForm[i] == 2 && i != j)
        finalSum = finalSum + minPrice + minPrice;
      else if (givenForm[i] == 2 && i == j)
        finalSum = finalSum + minPrice;
    } else {
      if (givenForm[i] == 2 && givenForm[j] == 0)
        finalSum += priceA;
      else if (givenForm[i] == 2 && givenForm[j] == 1)
        finalSum += priceB;
      else if (givenForm[j] == 2 && givenForm[i] == 0)
        finalSum += priceA;
      else if (givenForm[j] == 2 && givenForm[i] == 1)
        finalSum += priceB;
      else {
        isPossible = false;
        break;
      }
    }
  }
  if (!isPossible)
    cout << -1 << endl;
  else
    cout << finalSum << endl;
  return 0;
}
