#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, a, b, dancers[30];
  cin >> n >> a >> b;
  for (int i = 0; i < n; i++) cin >> dancers[i];
  int res = 0, p1 = 0, p2 = n - 1;
  while (p1 <= p2) {
    if ((dancers[p1] == 2 && dancers[p2] == 2)) {
      p1 != p2 ? res += (min(a, b))* 2 : res += min(a, b);
    } else if ((dancers[p1] == 2 || dancers[p2] == 2) &&
               (dancers[p1] == 0 || dancers[p2] == 0)) {
      res += a;
    } else if ((dancers[p1] == 2 || dancers[p2] == 2) &&
               (dancers[p1] == 1 || dancers[p2] == 1)) {
      res += b;
    } else if ((dancers[p1] == 1 || dancers[p2] == 1) &&
               (dancers[p1] == 0 || dancers[p2] == 0)) {
      cout << "-1";
      return 0;
    }
    p1++, p2--;
  }
  cout << res;
  return 0;
}
