#include <bits/stdc++.h>
using namespace std;
int a[21], n, b, c;
int main() {
  int i, j, ans = 0;
  cin >> n >> b >> c;
  for (i = 1; i <= n; i++) cin >> a[i];
  i = 1;
  j = n;
  while (i <= j) {
    if (i != j) {
      if (a[i] == a[j]) {
        if (a[i] == 2) ans += 2 * min(b, c);
      } else {
        if (a[i] == 2) {
          if (a[j] == 0)
            ans += b;
          else
            ans += c;
        } else if (a[j] == 2) {
          if (a[i] == 0)
            ans += b;
          else
            ans += c;
        } else {
          cout << "-1\n";
          return 0;
        }
      }
    } else {
      if (a[i] == 2) ans += min(b, c);
    }
    i++;
    j--;
  }
  cout << ans << "\n";
  return 0;
}
