#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, a, b, m, o, sum = 0;
  cin >> n >> a >> b;
  int ar[n + 5];
  for (int i = 1; i <= n; i++) {
    cin >> ar[i];
  }
  m = n / 2;
  o = n + 1;
  for (int i = 1; i <= m; i++) {
    if (ar[i] != ar[o - i]) {
      if (ar[i] != 2 && ar[o - i] != 2) {
        cout << -1 << endl;
        return 0;
      }
    }
  }
  if (n % 2 != 0) {
    if (ar[m + 1] == 2) sum = sum + min(a, b);
  }
  for (int i = 1; i <= m; i++) {
    if (ar[i] == 2 && ar[o - i] == 2) {
      sum = sum + (2 * min(a, b));
    } else if (ar[i] == 2 || ar[o - i] == 2) {
      if (ar[i] == 2) {
        if (ar[o - i] == 0)
          sum = sum + a;
        else
          sum = sum + b;
      } else if (ar[o - i] == 2) {
        if (ar[i] == 0)
          sum = sum + a;
        else
          sum = sum + b;
      }
    }
  }
  cout << sum << endl;
}
