#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  int n, a, b;
  cin >> n >> a >> b;
  vector<int> c(n);
  for (int i = 0; i < n; ++i) {
    cin >> c[i];
  }
  int i = 0, j = n - 1;
  int ans = 0;
  while (i < j) {
    if (c[i] == c[j] && c[i] != 2) {
      ++i;
      --j;
    } else if (c[i] != c[j] && c[i] != 2 && c[j] != 2) {
      cout << -1;
      return 0;
    } else if (c[i] == 2 && c[j] != 2) {
      if (c[j] == 0)
        ans += a;
      else if (c[j] == 1)
        ans += b;
      ++i;
      --j;
    } else if (c[j] == 2 && c[i] != 2) {
      if (c[i] == 0)
        ans += a;
      else if (c[i] == 1)
        ans += b;
      ++i;
      --j;
    } else if (c[i] == c[j] && c[i] == 2) {
      ans += 2 * min(a, b);
      ++i;
      --j;
    }
  }
  if (n % 2 && c[i] == 2) {
    ans += min(a, b);
  }
  cout << ans;
}
