#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, w, b, cost = 0, min = 0;
  int *color;
  cin >> n >> w >> b;
  if (w <= b)
    min = w;
  else
    min = b;
  color = new int[n];
  for (int i = 0; i < n; i++) cin >> color[i];
  for (int i = 0; i < (n / 2); i++) {
    if (color[i] != color[n - i - 1]) {
      if (color[i] != 2 && color[n - i - 1] != 2) {
        cost = -1;
        cout << cost;
        return 0;
      } else if (color[i] < color[n - i - 1]) {
        if (color[i] == 0)
          cost = cost + w;
        else
          cost = cost + b;
      } else if (color[i] > color[n - i - 1]) {
        if (color[n - i - 1] == 0)
          cost = cost + w;
        else
          cost = cost + b;
      }
    } else {
      if (color[i] == 2) cost = cost + min + min;
    }
  }
  if (n % 2 == 1) {
    if (color[n / 2] == 2) cost = cost + min;
  }
  cout << cost << endl;
}
