#include <bits/stdc++.h>
using namespace std;
const int inf = 0x3f3f3f3f;
const int ms = 100100;
int main() {
  ios::sync_with_stdio(0), cin.tie(0);
  int n, a, b;
  cin >> n >> a >> b;
  int v[n];
  for (int i = 0; i < n; i++) cin >> v[i];
  int ans = 0;
  for (int i = 0; i < n / 2; i++) {
    if (v[i] == 2 && v[n - i - 1] == 2) {
      ans += 2 * min(a, b);
      v[i] = v[n - i - 1] = -1;
    } else if (v[i] == 2 && v[n - i - 1] != 2) {
      if (v[n - i - 1] == 0)
        ans += a;
      else
        ans += b;
      v[i] = v[n - i - 1];
    } else if (v[i] != 2 && v[n - i - 1] == 2) {
      if (v[i] == 0)
        ans += a;
      else
        ans += b;
      v[n - i - 1] = v[i];
    } else if (v[i] != 2 && v[n - i - 1] != 2 && v[i] != v[n - i - 1]) {
      cout << -1;
      return 0;
    }
  }
  for (int i = 0; i < n; i++)
    if (v[i] == 2) {
      ans += min(a, b);
    }
  cout << ans;
  return 0;
}
