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