#include <bits/stdc++.h>
using namespace std;
long long npr(long long n, long long r) {
  long long res = 1;
  for (long long i = n; i > n - r; i--) res *= i;
  return res;
}
long long ncr(long long n, long long r) {
  if (r > n) return 0;
  if (r * 2 > n) r = n - r;
  if (r == 0) return 1;
  long long res = n;
  for (long long i = 2; i <= r; i++) {
    res *= (n - i + 1);
    res /= i;
  }
  return res;
}
string to_str(long long n) {
  stringstream ss;
  ss << n;
  return ss.str();
}
long long to_int(string str) {
  long long val;
  stringstream stream;
  stream << str;
  stream >> val;
  return val;
}
long long gcd(long long a, long long b) { return b == 0 ? a : gcd(b, a % b); }
long long lcm(long long n1, long long n2) {
  long long m = n1 * n2 / gcd(n1, n2);
  return m;
}
string binary(long long n) {
  string result;
  do result.push_back('0' + (n & 1));
  while (n >>= 1);
  reverse(result.begin(), result.end());
  return result;
}
long long fast_power(long long x, long long y) {
  if (y == 0) return 1;
  long long temp = fast_power(x, y / 2);
  temp = (temp * temp);
  if (y % 2 != 0) temp = temp * x;
  return temp;
}
bool comp(pair<int, int> v1, pair<int, int> v2) {
  if (v1.first == v2.first) {
    if (v1.second < v2.second)
      return true;
    else
      return false;
  }
  return (v1.first > v2.first);
}
long long n, x, y, z, c, c1, c2, c3, c4, k, k1, k2, t, arr[25];
int main() {
  ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  cin >> n >> x >> y;
  for (int i = 0; i < n; i++) cin >> arr[i];
  for (int i = 0; i < n / 2; i++) {
    if (arr[i] == arr[n - i - 1] && arr[i] == 2) c += 2 * min(x, y);
    if (arr[i] != arr[n - i - 1]) {
      if (arr[i] == 2) {
        if (arr[n - i - 1] == 0)
          c += x;
        else if (arr[n - i - 1] == 1)
          c += y;
      } else if (arr[n - i - 1] == 2) {
        if (arr[i] == 0)
          c += x;
        else if (arr[i] == 1)
          c += y;
      } else
        return cout << -1, 0;
    }
  }
  if (n & 1 && arr[n / 2] == 2) c += min(x, y);
  cout << c;
  return 0;
}
