#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, a, b;
  cin >> n >> a >> b;
  int dancers[n];
  for (int i = 0; i < n; i++) cin >> dancers[i];
  int left = 0;
  int right = n - 1;
  int cost = 0;
  int minCost = min(a, b);
  while (left <= right) {
    if (dancers[left] == dancers[right]) {
      if (dancers[left] == 2) {
        if (left != right)
          cost = cost + 2 * minCost;
        else
          cost += minCost;
      }
    } else {
      if (dancers[left] != 2 && dancers[right] != 2) {
        cost = -1;
        break;
      } else if (dancers[left] == 2) {
        cost += dancers[right] == 0 ? a : b;
      } else if (dancers[right] == 2) {
        cost += dancers[left] == 0 ? a : b;
      }
    }
    left++;
    right--;
  }
  cout << cost << "\n";
}
