#include <bits/stdc++.h>
using namespace std;
const int INF = 0x3f3f3f3f;
int a[100000 + 5];
int main() {
  int i, j, k;
  int n, m, b, c;
  cin >> n >> b >> c;
  for (i = 0; i < n; i++) cin >> a[i];
  int co = 0, cou = 0;
  int flag = 0;
  for (i = 0, j = n - 1; i < j; i++, j--) {
    if (a[j] != 2 && a[i] != 2) {
      if (a[i] != a[j]) {
        flag = 1;
        break;
      }
    } else {
      if (a[i] == 2) {
        if (a[j] == 1)
          cou += c;
        else if (a[j] == 0)
          cou += b;
        else
          cou += min(b, c) * 2;
      } else if (a[i] == 1) {
        if (a[j] == 2) cou += c;
      } else {
        if (a[j] == 2) cou += b;
      }
    }
  }
  if (flag)
    cout << -1 << endl;
  else {
    if (n % 2) {
      if (a[n / 2] == 2) cou += min(b, c);
    }
    cout << cou << endl;
  }
}
