#include <bits/stdc++.h>
using namespace std;
int min(int x, int y) { return (x < y) ? x : y; }
int main() {
  int n, a, b, c = 0, d = 0, flag = 0, ans = 0;
  cin >> n >> a >> b;
  int arr[n];
  for (int i = 0; i < n; i++) {
    cin >> arr[i];
  }
  int k = min(a, b);
  int l = 0, h = n - 1;
  for (int i = 0; i < n / 2; i++) {
    if (arr[l] == 0) {
      if (arr[h] == 0) {
        l++;
        h--;
      } else if (arr[h] == 2) {
        c++;
        l++;
        h--;
      } else {
        flag = 1;
        break;
      }
    } else if (arr[l] == 1) {
      if (arr[h] == 1) {
        l++;
        h--;
      } else if (arr[h] == 2) {
        d++;
        l++;
        h--;
      } else {
        flag = 1;
        break;
      }
    } else if (arr[l] == 2) {
      if (arr[h] == 0) {
        c++;
        l++;
        h--;
      } else if (arr[h] == 1) {
        d++;
        l++;
        h--;
      } else {
        if (k == a) {
          c = c + 2;
          l++;
          h--;
        } else {
          d = d + 2;
          l++;
          h--;
        }
      }
    }
  }
  if (n % 2 != 0) {
    if (arr[l] == 2) {
      if (k == a) {
        c++;
      } else if (k == b) {
        d++;
      }
    }
  }
  if (flag == 1)
    cout << -1 << endl;
  else {
    ans = c * a + d * b;
    cout << ans << endl;
  }
  return 0;
}
