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