#include <bits/stdc++.h>
using namespace std;
bool check_palindrome(vector<long long> &v, long long n) {
  vector<long long> v2 = v;
  reverse(v2.begin(), v2.end());
  for (long long i = 0; i < n; i++) {
    if (v[i] != v2[i]) {
      return false;
    }
  }
  return true;
}
void sol(long long i, long long n, vector<long long> v, long long &ans,
         long long a, long long b, long long tempsum) {
  if (i == n) {
    if (check_palindrome(v, n)) {
      ans = min(tempsum, ans);
    }
    return;
  }
  if (v[i] != 2) {
    sol(i + 1, n, v, ans, a, b, tempsum);
    return;
  }
  v[i] = 1;
  sol(i + 1, n, v, ans, a, b, tempsum + b);
  v[i] = 0;
  sol(i + 1, n, v, ans, a, b, tempsum + a);
  return;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long n, a, b;
  cin >> n >> a >> b;
  vector<long long> v(n);
  for (auto &x : v) {
    cin >> x;
  }
  long long ans = INT_MAX;
  sol(0, n, v, ans, a, b, 0);
  if (ans == INT_MAX) {
    cout << -1 << '\n';
    return 0;
  }
  cout << ans;
  return 0;
}
