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