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