#include <bits/stdc++.h>
using namespace std;
const int inf = 0x3f3f3f3f;
int intcmp(const void *v1, const void *v2) { return *(int *)v1 - *(int *)v2; }
inline int read() {
  int x = 0, f = 1;
  char cc = getchar();
  while (cc < '0' || cc > '9') {
    if (cc == '-') f = -1;
    cc = getchar();
  }
  while (cc >= '0' && cc <= '9') {
    x = x * 10 + cc - '0';
    cc = getchar();
  }
  return x * f;
}
const int maxn = 100;
int c[maxn];
int n, a, b;
int main() {
  n = read();
  a = read();
  b = read();
  int cost = 0;
  for (int i = 0; i < n; i++) scanf("%d", c + i);
  for (int i = 0; i < n / 2; i++) {
    if (c[i] != 2 && c[n - 1 - i] != 2) {
      if (c[i] != c[n - 1 - i]) {
        puts("-1");
        return 0;
      }
    } else if (c[i] == 1 || c[n - i - 1] == 1) {
      cost += b;
    } else if (c[i] == 2 && c[n - i - 1] == 2) {
      cost += 2 * min(a, b);
    } else
      cost += a;
  }
  if (n % 2) {
    if (c[n / 2] == 2) {
      cost += min(a, b);
    }
  }
  cout << cost << endl;
  return 0;
}
