#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, arr, b, i, flag = 0, minn = 0, sum = 0, flag1 = 0;
  cin >> n >> arr >> b;
  int a[n];
  if (arr > b)
    minn = 1;
  else
    minn = 0;
  for (i = 0; i < n; i++) cin >> a[i];
  int m;
  m = n - 1;
  for (i = 0; i < n; i++) {
    if (a[i] == 2) {
      flag1 = 1;
      if (a[i] != a[m - i]) {
        a[i] = a[m - i];
        if (a[m - i] == 1)
          sum = sum + b;
        else
          sum = sum + arr;
      } else if (a[i] == a[m - i] && i == m - i) {
        a[i] = minn;
        a[m - i] = minn;
        if (minn == 1)
          sum = sum + b;
        else
          sum = sum + arr;
      } else if (a[i] == a[m - i] && i != m - i) {
        a[i] = minn;
        a[m - i] = minn;
        if (minn == 1)
          sum = sum + 2 * b;
        else
          sum = sum + 2 * arr;
      }
    }
  }
  for (i = 0; i < n; i++) {
    if (a[i] != a[m - i]) flag = 1;
  }
  if (flag == 0 && flag1 == 1) {
    cout << sum;
  }
  if (flag == 1) cout << "-1";
  if (flag1 == 0 && flag == 0) cout << "0";
}
