#include <bits/stdc++.h>
using namespace std;
bool check(string s) {
  string r = "";
  for (int i = 0; i < s.size(); i++) r += s[i];
  reverse(s.begin(), s.end());
  bool ok = 1;
  for (int i = 0; i < s.size(); i++)
    if (s[i] != r[i]) return 0;
  return 1;
}
int num[25];
int main(void) {
  int n, a, b;
  cin >> n >> a >> b;
  swap(a, b);
  for (int i = 0; i < n; i++) cin >> num[i];
  int ans = 1e9 + 10;
  for (int mask = 0; mask < 1 << n; mask++) {
    string aux = "";
    int ax = 0;
    for (int j = n - 1; j >= 0; j--) {
      if (num[j] == 1) aux += "1";
      if (num[j] == 0) aux += "0";
      if (num[j] == 2) {
        if (mask & (1 << j))
          ax += a, aux += "1";
        else
          ax += b, aux += "0";
      }
    }
    if (check(aux)) ans = min(ans, ax);
  }
  if (ans == 1e9 + 10)
    cout << "-1\n";
  else
    cout << ans << "\n";
}
