#include <bits/stdc++.h>
using namespace std;
const int INF = 1e9 + 7;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n, a, b;
  cin >> n >> a >> b;
  int arr[n];
  for (int i = 0; i < n; i++) cin >> arr[i];
  int ans = 0, f = 0;
  for (int i = 0; i < n / 2; i++) {
    if (arr[i] == arr[n - i - 1] && arr[i] != 2) continue;
    if (arr[i] == 2 && arr[n - i - 1] == 1) {
      ans += b;
      continue;
    }
    if (arr[i] == 2 && arr[n - i - 1] == 0) {
      ans += a;
      continue;
    }
    if (arr[n - i - 1] == 2 && arr[i] == 1) {
      ans += b;
      continue;
    }
    if (arr[n - i - 1] == 2 && arr[i] == 0) {
      ans += a;
      continue;
    }
    if (arr[i] == 2 && arr[n - i - 1] == 2) {
      ans += 2 * min(a, b);
      continue;
    }
    cout << -1 << endl;
    return 0;
  }
  if (arr[n / 2] == 2 && n % 2 == 1) {
    ans += min(a, b);
  }
  cout << ans << endl;
  return 0;
}
