#include <bits/stdc++.h>
using namespace std;
int n, a, b;
int t[4], q[30];
int main() {
  cin >> n >> t[0] >> t[1];
  t[2] = min(t[0], t[1]);
  for (int i = 1; i <= n; i++) cin >> q[i];
  int sum = 0;
  for (int i = 1; i <= (n / 2); i++) {
    if (q[i] + q[n - i + 1] == 1) {
      sum = -1;
      break;
    }
    if (q[i] == 2) sum += t[q[n - i + 1]];
    if (q[n - i + 1] == 2) sum += t[q[i]];
  }
  if (sum != -1 && n % 2 == 1 && q[n / 2 + 1] == 2) sum += t[2];
  cout << sum;
}
