#include <bits/stdc++.h>
using namespace std;
int n, mw, mb, ans;
int a[30];
int main() {
  scanf("%d%d%d", &n, &mw, &mb);
  for (int i = 1; i <= n; i++) scanf("%d", &a[i]);
  for (int i = 1; i <= n / 2; i++) {
    if (a[i] == a[n - i + 1] && a[i] != 2)
      continue;
    else if (a[i] == a[n - i + 1] && a[i] == 2)
      ans += 2 * min(mw, mb);
    else {
      if (a[i] != 2 && a[n - i + 1] != 2) {
        printf("-1");
        return 0;
      } else {
        if (a[i] == 0 || a[n - i + 1] == 0)
          ans += mw;
        else
          ans += mb;
      }
    }
  }
  if (n % 2 == 1 && a[n / 2 + 1] == 2) ans += min(mw, mb);
  printf("%d", ans);
  return 0;
}
