#include <bits/stdc++.h>
using namespace std;
int n, i, rez, A[25], val, C[5];
int main() {
  ios::sync_with_stdio(false);
  cin >> n >> C[0] >> C[1];
  for (i = 1; i <= n; i++) cin >> A[i];
  val = n / 2;
  for (i = 1; i <= val; i++) {
    if (A[i] == 2) {
      if (A[n - i + 1] == 2)
        rez += (2 * min(C[0], C[1]));
      else
        rez += C[A[n - i + 1]];
    } else {
      if (A[n - i + 1] == 2)
        rez += C[A[i]];
      else {
        if (A[i] != A[n - i + 1]) {
          cout << "-1\n";
          return 0;
        }
      }
    }
  }
  if (n % 2 == 1) {
    if (A[n / 2 + 1] == 2) rez += min(C[0], C[1]);
  }
  cout << rez << "\n";
  return 0;
}
