#include <bits/stdc++.h>
using ll = long long;
using ull = unsigned long long;
using namespace std;
int main() {
  ll t = 1;
  while (t--) {
    ll n, a, b, i, j, k, c = 0;
    vector<ll> v;
    cin >> n >> a >> b;
    for (i = 0; i < n; i++) {
      ll q;
      cin >> q;
      v.push_back(q);
    }
    if (n % 2 == 1) {
      if (v[n / 2] == 2) {
        c = c + min(a, b);
      }
    }
    for (i = 0; i < n / 2; i++) {
      if (v[i] == v[n - i - 1]) {
        if (v[i] == 2) {
          c = c + 2 * min(a, b);
        }
      } else {
        if (v[i] + v[n - i - 1] == 1) {
          cout << -1;
          return 0;
        }
        if (v[i] + v[n - i - 1] == 2) {
          c = c + a;
        }
        if (v[i] + v[n - i - 1] == 3) {
          c = c + b;
        }
      }
    }
    cout << c;
  }
  return 0;
}
