#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  short n, a, b;
  cin >> n >> a >> b;
  short values[n];
  for (short i = 0; i < n; i++) cin >> values[i];
  int total = 0;
  for (short i = 0; i < n / 2; i++) {
    if (values[i] == 2 && values[n - i - 1] == 2)
      total += (a < b ? a : b) * 2;
    else if (values[i] ^ values[n - i - 1]) {
      if (values[i] == 2 || values[n - i - 1] == 2) {
        if (values[i] + values[n - i - 1] - 2 == 0)
          total += a;
        else
          total += b;
      } else if (values[i] ^ 2)
        if (values[n - i - 1] ^ 2) {
          cout << -1;
          return 0;
        }
    }
  }
  if (n & 1)
    if (values[n / 2] == 2) total += (a < b ? a : b);
  cout << total;
}
