#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e4 + 5;
const int mod = 1e9 + 7;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int n, a, b;
  cin >> n >> a >> b;
  int c[n + 5];
  for (int i = 0; i < n; i++) cin >> c[i];
  long long ans = 0;
  for (int i = 0, j = n - 1; i < j; i++, j--) {
    if (c[i] != c[j] && c[i] != 2 && c[j] != 2) {
      cout << -1 << endl;
      return 0;
    }
    if (c[i] == c[j] && c[i] == 2)
      ans += (2 * min(a, b));
    else if (c[i] != c[j] && c[i] == 2) {
      if (c[j] == 0)
        ans += a;
      else
        ans += b;
    } else if (c[i] != c[j] && c[j] == 2) {
      if (c[i] == 0)
        ans += a;
      else
        ans += b;
    }
  }
  if (n & 1) {
    if (c[n / 2] == 2) ans += min(a, b);
  }
  cout << ans << endl;
  return 0;
}
