#include <bits/stdc++.h>
using namespace std;
enum { MAXN = 200010 };
int n, p[2], a[30], ans;
int main() {
  ios_base::sync_with_stdio(0);
  cin >> n >> p[0] >> p[1];
  for (int i = 1; i <= n; ++i) {
    cin >> a[i];
  }
  int x = 1, y = n;
  while (x - y <= 0) {
    if (a[x] != 2 && a[y] != 2 && a[x] != a[y]) {
      cout << -1;
      return 0;
    }
    if (a[x] == 2 && a[y] == 2) {
      if (x != y)
        ans += 2 * min(p[0], p[1]);
      else
        ans += min(p[0], p[1]);
    }
    if (a[x] == 2 && a[y] != 2) {
      ans += p[a[y]];
    }
    if (a[x] != 2 && a[y] == 2) {
      ans += p[a[x]];
    }
    ++x;
    --y;
  }
  cout << ans;
}
