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