#include <bits/stdc++.h>
using namespace std;
int c[25];
int main() {
  ios::sync_with_stdio(false);
  int n, a, b, res = 0;
  cin >> n >> a >> b;
  for (int i = 1; i <= n; i++) cin >> c[i];
  for (int i = 1; i <= n / 2; i++) {
    if (c[i] != 2 && c[n + 1 - i] != 2) {
      if (c[i] != c[n + 1 - i]) {
        cout << "-1" << endl;
        return 0;
      }
    } else {
      if (c[i] == 2 && c[n + 1 - i] == 2)
        res += 2 * min(a, b);
      else if (c[i] == 2) {
        if (c[n + 1 - i] == 0)
          res += a;
        else
          res += b;
      } else {
        if (c[i] == 0)
          res += a;
        else
          res += b;
      }
    }
  }
  if (n % 2) {
    if (c[n / 2 + 1] == 2) res += min(a, b);
  }
  cout << res << endl;
  return 0;
}
