#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int n, c, b;
  cin >> n >> c >> b;
  int a[n];
  for (int i = 0; i < n; i++) cin >> a[i];
  int sum = 0, flag = 0, t;
  if (n % 2 == 0)
    t = (n / 2);
  else
    t = (n / 2) + 1;
  for (int i = 0; i < t; i++) {
    if (a[i] != a[n - i - 1] && a[i] != 2 && a[n - 1 - i] != 2) {
      flag = 1;
      break;
    } else if (a[i] != a[n - i - 1] && a[i] == 2 && a[n - i - 1] != 2) {
      if (a[n - i - 1] == 0)
        sum += c;
      else
        sum += b;
    } else if (a[i] != a[n - i - 1] && a[i] != 2 && a[n - i - 1] == 2) {
      if (a[i] == 0)
        sum += c;
      else
        sum += b;
    } else if (a[i] == 2 && a[n - i - 1] == 2) {
      if (i != n - i - 1)
        sum += 2 * min(c, b);
      else
        sum += min(c, b);
    }
  }
  if (flag)
    cout << -1;
  else
    cout << sum;
}
