#include <bits/stdc++.h>
using namespace std;
const int maxn = 105;
int s[maxn];
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0), cout.tie(0);
  int n, a, b, ans = 0;
  cin >> n >> a >> b;
  int mi = min(a, b);
  for (int i = 0; i < n; i++) {
    cin >> s[i];
  }
  for (int i = 0; i < n / 2; i++) {
    if (s[i] == 2 || s[n - 1 - i] == 2 || s[n - 1 - i] == s[i]) {
      if ((s[i] == 0 && s[n - 1 - i] == 2) || (s[i] == 2 && s[n - 1 - i] == 0))
        ans += a;
      if ((s[i] == 1 && s[n - 1 - i] == 2) || (s[i] == 2 && s[n - 1 - i] == 1))
        ans += b;
      if (s[i] == 2 && s[n - 1 - i] == 2) ans += mi * 2;
      continue;
    } else {
      cout << "-1";
      return 0;
    }
  }
  if (n % 2 == 1 && s[(n - 1) / 2] == 2) ans += mi;
  cout << ans;
  return 0;
}
