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