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