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