#include <bits/stdc++.h>
using namespace std;
int c[20];
int main() {
  int n, a, b, cost = 0;
  scanf("%d%d%d", &n, &a, &b);
  for (int i = 0; i < n; i++) scanf("%d", &c[i]);
  if (n % 2 == 1 && c[n / 2] == 2) cost += min(a, b);
  for (int i = 0, j; i < n / 2 && cost >= 0; i++) {
    j = n - i - 1;
    if (c[i] + c[j] == 1)
      cost = -1;
    else if (c[i] == 2 && c[j] == 2)
      cost += 2 * min(a, b);
    else if (c[i] == 2 && c[j] == 0 || c[i] == 0 && c[j] == 2)
      cost += a;
    else if (c[i] == 2 && c[j] == 1 || c[i] == 1 && c[j] == 2)
      cost += b;
  }
  printf("%d\n", cost);
}
