#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
  int n, a, b;
  cin >> n >> a >> b;
  vector<int> p(n);
  for (int i = 0; i < n; i++) cin >> p[i];
  for (int i = 0; i < n / 2; i++) {
    if (!(p[i] == p[n - i - 1] || p[i] == 2 || p[n - i - 1] == 2)) {
      cout << -1 << endl;
      return 0;
    }
  }
  int ans = 0;
  for (int i = 0; i < n / 2; i++) {
    if (p[i] == 2) {
      if (p[n - i - 1] == 2)
        ans += 2 * min(a, b);
      else if (p[n - i - 1] == 0)
        ans += a;
      else
        ans += b;
    } else if (p[i] == 1) {
      if (p[n - i - 1] == 1)
        continue;
      else
        ans += b;
    } else {
      if (p[n - i - 1] == 0)
        continue;
      else
        ans += a;
    }
  }
  if (n % 2 != 0 && p[n / 2] == 2) ans += min(a, b);
  cout << ans << endl;
  return 0;
}
