#include <bits/stdc++.h>
using namespace std;
const int maxn = 25;
int n, k[3], a[maxn];
int main() {
  scanf("%d%d%d", &n, &k[0], &k[1]);
  int qq = min(k[0], k[1]);
  long long ans = 0;
  for (register int i = 1; i <= n; i++) {
    scanf("%d", &a[i]);
  }
  for (register int i = 1; i <= n; i++) {
    if (i > n - i + 1) break;
    if (a[i] != 2 && a[n - i + 1] != 2 && a[i] != a[n - i + 1]) {
      printf("-1");
      return 0;
    }
    if (a[i] == 2 && a[n - i + 1] == 2 && i != n - i + 1) ans += qq * 2;
    if (a[i] == 2 && a[n - i + 1] == 2 && i == n - i + 1) ans += qq;
    if (a[i] == 2) ans += k[a[n - i + 1]];
    if (a[n - i + 1] == 2) ans += k[a[i]];
  }
  printf("%I64d", ans);
  return 0;
}
