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