#include <bits/stdc++.h>
int min(int a, int b) {
  if (a > b)
    return b;
  else
    return a;
}
int main() {
  int n, a, b, cost = 0;
  std::cin >> n >> a >> b;
  int c[n];
  for (int i = 0; i < n; i++) {
    std::cin >> c[i];
  }
  for (int i = 0; i <= n / 2 - 1; i++) {
    if (c[i] != 2 && c[n - 1 - i] != 2 && c[i] != c[n - 1 - i]) {
      std::cout << "-1" << '\n';
      return 0;
    }
    if (c[i] == c[n - 1 - i] && c[i] == 2) {
      cost += 2 * min(a, b);
    }
    if (c[i] != c[n - 1 - i] && (c[i] != 2 || c[n - i - 1] != 2)) {
      if (c[i] != 2) {
        c[n - i - 1] = c[i];
        if (c[i] == 0) cost += a;
        if (c[i] == 1) cost += b;
      } else if (c[n - 1 - i] != 2) {
        c[i] = c[n - 1 - i];
        if (c[n - 1 - i] == 0) cost += a;
        if (c[n - 1 - i] == 1) cost += b;
      }
    }
  }
  if (n % 2 == 1) {
    if (c[n / 2] == 2) {
      cost += min(a, b);
    }
  }
  std::cout << cost << '\n';
  return 0;
}
