#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 3;
int n, m, x, y, z, h[N], hh[N], k, l, i, j, s, t;
int main() {
  cin >> n >> x >> y;
  for (i = 1; i <= n; i++) scanf("%d", h + i);
  hh[0] = x;
  hh[1] = y;
  for (i = 1; i <= n / 2; i++) {
    if (h[i] < 2 and h[n - i + 1] < 2 and h[i] != h[n - i + 1]) {
      cout << -1 << '\n';
      return 0;
    }
    if (h[i] == h[n - i + 1] and h[i] == 2)
      s += 2 * min(x, y);
    else if (h[i] == 2)
      s += hh[h[n - i + 1]];
    else if (h[n - i + 1] == 2)
      s += hh[h[i]];
  }
  if (n % 2 and h[i] == 2) s += min(x, y);
  cout << s << '\n';
}
