#include <bits/stdc++.h>
using namespace std;
const long long mod = 1e9 + 7;
const long long inf = LLONG_MAX;
const long long N = 1e5 + 10;
int main() {
  ios_base ::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long n, a, b;
  cin >> n >> a >> b;
  long long arr[n + 1];
  for (long long i = 1; i <= n; ++i) {
    cin >> arr[i];
  }
  long long res = 0;
  for (long long i = 1; i <= n / 2; ++i) {
    if (arr[i] == 2) {
      if (arr[n - i + 1] == 2) {
        res += 2 * min(a, b);
      } else if (arr[n - i + 1] == 0) {
        res += a;
      } else {
        res += b;
      }
    } else if (arr[i] == 0) {
      if (arr[n - i + 1] == 1) {
        cout << "-1\n";
        return 0;
      } else if (arr[n - i + 1] == 2) {
        res += a;
      }
    } else {
      if (arr[n - i + 1] == 0) {
        cout << "-1\n";
        return 0;
      } else if (arr[n - i + 1] == 2) {
        res += b;
      }
    }
  }
  if ((n & 1) && (arr[(n + 1) / 2] == 2)) {
    res += min(a, b);
  }
  cout << res << "\n";
  return 0;
}
