#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, a, b;
  cin >> n >> a >> b;
  long long int sum = 0;
  int mn = min(a, b);
  int ar[n];
  for (int i = 0; i < n; i++) cin >> ar[i];
  int f = 0, e = n - 1;
  while (f < e) {
    if (ar[f] == 0) {
      if (ar[e] == 1) {
        cout << "-1";
        return 0;
      }
      if (ar[e] == 2) {
        sum += a;
      }
    } else if (ar[f] == 1) {
      if (ar[e] == 0) {
        cout << "-1";
        return 0;
      } else if (ar[e] == 2)
        sum += b;
    } else {
      if (ar[e] == 2) {
        sum += mn;
        sum += mn;
      } else if (ar[e] == 0)
        sum += a;
      else
        sum += b;
    }
    f++;
    e--;
  }
  if (f == e) {
    if (ar[f] == 2) sum += mn;
  }
  cout << sum << endl;
}
