#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, a, b, arr[25], ans = 0, c[3];
  bool r1 = 1;
  cin >> n >> a >> b;
  c[0] = a, c[1] = b;
  for (int i = 0; i < n; i++) {
    cin >> arr[i];
  }
  int mid = n / 2;
  if (2 * mid < n) mid++;
  for (int i = 0; i < mid; i++) {
    if (arr[i] == arr[n - i - 1] && arr[i] != 2) {
      continue;
    } else if (arr[i] == arr[n - i - 1] && arr[i] == 2) {
      if (i == n - i - 1)
        ans += min(a, b);
      else
        ans += 2 * min(a, b);
    } else if (arr[i] == 2 || arr[n - i - 1] == 2) {
      if (arr[i] == 2)
        ans += c[arr[n - i - 1]];
      else
        ans += c[arr[i]];
    } else
      r1 = 0;
  }
  if (r1)
    cout << ans << endl;
  else
    cout << -1 << endl;
  return 0;
}
