#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, a, b, i;
  cin >> n >> a >> b;
  int d[22];
  for (i = 0; i < n; i++) {
    cin >> d[i];
  }
  int w, bl, m, c = 0;
  if (a < b)
    m = a;
  else
    m = b;
  w = 0;
  bl = 0;
  for (i = 0; i < n / 2; i++) {
    if (d[i] == d[n - i - 1]) {
      if (d[i] == 2 && d[n - i - 1] == 2) {
        c += m * 2;
      }
    } else {
      if (d[i] != 2 && d[n - 1 - i] != 2) {
        cout << -1;
        return 0;
      }
      if (d[i] == 0 || d[n - i - 1] == 0) {
        c += a;
      } else
        c += b;
    }
  }
  if (n % 2 != 0) {
    if (d[n / 2] == 2) c += m;
  }
  cout << c;
  return 0;
}
