#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(0);
  ;
  int sum = 0, mn, n, m, a, b, i, j, a0 = 0, a1 = 0, f = 0;
  cin >> n >> a >> b;
  int c[n + 4];
  for (i = 1; i <= n; i++) cin >> c[i];
  mn = min(a, b);
  if (n % 2) {
    for (i = 1, j = n; i <= n / 2; i++, j--) {
      if (c[i] == 2 && c[j] == 2) {
        sum += (2 * mn);
      } else if (c[i] == 2 && c[j] != 2) {
        if (c[j] == 1)
          sum += b;
        else
          sum += a;
      } else if (c[i] != 2 && c[j] == 2) {
        if (c[i] == 1)
          sum += b;
        else
          sum += a;
      } else if (c[i] != 2 && c[j] != 2 && c[i] != c[j])
        f = 1;
    }
    if (c[n / 2 + 1] == 2) sum += mn;
  } else {
    for (i = 1, j = n; i <= n / 2; i++, j--) {
      if (c[i] == 2 && c[j] == 2) {
        sum += (2 * mn);
      } else if (c[i] == 2 && c[j] != 2) {
        if (c[j] == 1)
          sum += b;
        else
          sum += a;
      } else if (c[i] != 2 && c[j] == 2) {
        if (c[i] == 1)
          sum += b;
        else
          sum += a;
      } else if (c[i] != 2 && c[j] != 2 && c[i] != c[j])
        f = 1;
    }
  }
  if (f)
    cout << -1 << endl;
  else
    cout << sum << endl;
}
