#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, b, c;
  cin >> n >> b >> c;
  int tab[n];
  int suma = 0;
  for (int i = 0; i < n; i++) {
    int x;
    cin >> x;
    tab[i] = x;
  }
  for (int i = 0; i < ((n - (n % 2)) / 2); i++) {
    if (tab[i] == 2 && tab[n - i - 1] == 2) {
      if (b < c)
        suma += 2 * b;
      else
        suma += 2 * c;
    } else if (tab[i] == 1 && tab[n - i - 1] == 2)
      suma += c;
    else if (tab[i] == 2 && tab[n - i - 1] == 1)
      suma += c;
    else if (tab[i] == 0 && tab[n - i - 1] == 2)
      suma += b;
    else if (tab[i] == 2 && tab[n - i - 1] == 0)
      suma += b;
    else if (tab[i] != tab[n - i - 1]) {
      cout << "-1";
      return 0;
    }
  }
  if (n % 2 == 1) {
    if (tab[((n - 1) / 2)] == 2) {
      if (b < c)
        suma += b;
      else
        suma += c;
    }
  }
  cout << suma;
  return 0;
}
