#include <bits/stdc++.h>
using namespace std;
int n, a[5];
int c[100];
int main() {
  ios_base::sync_with_stdio(false);
  cin >> n >> a[0] >> a[1];
  for (int i = 1; i <= n; i++) cin >> c[i];
  int m = min(a[0], a[1]);
  int ans = 0;
  for (int i = 1; i <= n / 2 + n % 2; i++) {
    if (c[i] == 2 && c[n - i + 1] == 2) {
      if (i != n / 2 + n % 2)
        ans += 2 * m;
      else if (n % 2 == 0)
        ans += 2 * m;
      else
        ans += m;
    } else if (c[i] == 2)
      ans += a[c[n - i + 1]];
    else if (c[n - i + 1] == 2)
      ans += a[c[i]];
    else if (c[i] != c[n - i + 1]) {
      cout << -1;
      return 0;
    }
  }
  cout << ans;
  return 0;
}
