#include <bits/stdc++.h>
using namespace std;
string ch;
int main() {
  unsigned long long i, j, k, t, l, n, m, a1, a2, a3, b, h, c, a, ans = 0,
                                                                  flag = 1;
  cin >> n >> a >> b;
  unsigned long long arr[n];
  for (i = 0; i < n; i++) {
    cin >> arr[i];
  }
  if (n & 1) {
    k = n / 2;
    if (arr[k] == 2) ans += min(a, b);
  }
  for (i = 0; i < n / 2; i++) {
    if (arr[i] == arr[n - i - 1]) {
      if (arr[i] == 2) ans += 2 * min(a, b);
      continue;
    } else if ((arr[i] == 1 && arr[n - i - 1] == 0) ||
               (arr[i] == 0 && arr[n - i - 1] == 1)) {
      flag = 0;
      break;
    } else {
      if (arr[i] == 2) {
        if (arr[n - i - 1] == 0)
          ans += a;
        else
          ans += b;
      } else if (arr[n - i - 1] == 2) {
        if (arr[i] == 0)
          ans += a;
        else
          ans += b;
      }
    }
  }
  if (flag)
    cout << ans;
  else
    cout << -1;
  return 0;
}
