#include <bits/stdc++.h>
using namespace std;
long long int arr[10005];
int main() {
  long long int n, b, w;
  scanf("%lld%lld%lld", &n, &w, &b);
  long long int ans = 0;
  for (long long int i = 1; i <= n; i++) {
    scanf("%lld", &arr[i]);
  }
  for (long long int i = 1, j = n; i <= j; i++, j--) {
    if (arr[i] == arr[j]) {
      if (arr[i] == 2) {
        ans += min(w, b);
        if (i != j) ans += min(w, b);
      }
    } else if (arr[i] != arr[j]) {
      if (arr[i] == 2) {
        if (arr[j])
          ans += b;
        else
          ans += w;
      } else if (arr[j] == 2) {
        if (arr[i])
          ans += b;
        else
          ans += w;
      } else {
        ans = -1;
        break;
      }
    }
  }
  printf("%lld\n", ans);
  return 0;
}
