#include <bits/stdc++.h>
using namespace std;
const int MAX = 1e6;
int main() {
  int n, a, b;
  cin >> n >> a >> b;
  int x[n + 2];
  for (int i = 0; i < n; i++) cin >> x[i];
  long long sum = 0;
  for (int i = 0; i < n / 2; i++) {
    if (x[i] != x[n - i - 1]) {
      int s1 = x[i], s2 = x[n - i - 1];
      if ((s1 == 2 && s2 == 0) || (s2 == 2 && s1 == 0))
        sum += a;
      else if ((s1 == 2 && s2 == 1) || (s2 == 2 && s1 == 1))
        sum += b;
      else {
        cout << -1 << endl;
        return 0;
      }
    } else if (x[i] == 2 && x[n - i - 1] == 2)
      sum += 2 * min(a, b);
  }
  if (n & 1 && x[n / 2] == 2) sum += min(a, b);
  cout << sum << endl;
}
