#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, x, y;
  cin >> n >> x >> y;
  int a[n];
  for (int i = 0; i < n; i++) cin >> a[i];
  int sum = 0;
  bool flag = 0;
  for (int i = 0; i < n; i++) {
    if (a[i] == 0) {
      if (a[n - 1 - i] == 0) continue;
      if (a[n - 1 - i] == 2) {
        sum += x;
        a[n - 1 - i] = 0;
        continue;
      } else {
        cout << -1 << endl;
        flag = 1;
        break;
      }
    }
    if (a[i] == 1) {
      if (a[n - 1 - i] == 1) continue;
      if (a[n - 1 - i] == 2) {
        sum += y;
        a[n - 1 - i] = 1;
        continue;
      } else {
        cout << -1 << endl;
        flag = 1;
        break;
      }
    }
    if (a[i] == 2) {
      if (a[n - 1 - i] == 2) {
        sum += min(x, y);
        continue;
      } else
        continue;
    }
  }
  if (flag == 0) cout << sum;
  return 0;
}
