#include <bits/stdc++.h>
using namespace std;
int n;
int a, b;
int arr[220];
int val[3];
int sum = 0;
int main() {
  scanf("%d %d %d", &n, &val[0], &val[1]);
  int mini = min(val[0], val[1]);
  for (int i = 0; i < n; i++) scanf("%d", &arr[i]);
  for (int i = 0; i < n / 2; i++) {
    if (arr[i] == 2 && arr[n - i - 1] == 2) {
      sum += mini;
      sum += mini;
    } else if (arr[i] == 2) {
      sum += val[arr[n - i - 1]];
    } else if (arr[n - i - 1] == 2) {
      sum += val[arr[i]];
    } else if (arr[i] != arr[n - i - 1]) {
      puts("-1");
      return 0;
    }
  }
  if (n % 2 == 1 && arr[n / 2] == 2) {
    sum += mini;
  }
  printf("%d", sum);
}
