#include <bits/stdc++.h>
const int dx[] = {0, -1, 0, 1, -1, 1, 1, -1, -2, -2, 2, 2, -1, -1, 1, 1};
const int dy[] = {-1, 0, 1, 0, 1, 1, -1, -1, -1, 1, -1, 1, -2, 2, -2, 2};
using namespace std;
vector<int> graph[200005];
vector<int> opt(200005);
int dfs(int node) {
  if (opt[node]) return opt[node];
  int ret = 0;
  for (int i = 0; i < graph[node].size(); i++) {
    ret = max(ret, dfs(graph[node][i]));
  }
  return opt[node] = ret + 1;
}
int main(int argc, char const *argv[]) {
  int n;
  scanf("%d", &n);
  int x, y;
  scanf("%d %d", &x, &y);
  int cost = 0;
  vector<int> clr(n);
  for (int i = 0; i < n; i++) scanf("%d", &clr[i]);
  for (int i = 0, j = n - 1; i <= j; i++, j--) {
    if (clr[i] == clr[j]) {
      if (clr[i] == 2) cost += i == j ? min(x, y) : 2 * min(x, y);
    } else if (clr[i] == 2) {
      if (clr[j] == 0)
        cost += x;
      else
        cost += y;
    } else if (clr[j] == 2) {
      if (clr[i] == 0)
        cost += x;
      else
        cost += y;
    } else {
      cout << -1 << endl;
      return 0;
    }
  }
  cout << cost << endl;
}
