#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e5 + 7;
const int mod = 1e9 + 7;
int n, a[2], c[maxn];
int main() {
  while (~scanf("%d%d%d", &n, &a[0], &a[1])) {
    for (int i = 0; i < n; i++) scanf("%d", &c[i]);
    int i = 0, j = n - 1;
    bool f = true;
    long long ans = 0;
    while (i < j) {
      if (c[i] == 2 && c[j] == 2)
        ans += 2 * min(a[0], a[1]);
      else if (c[i] == 2)
        ans += a[c[j]];
      else if (c[j] == 2)
        ans += a[c[i]];
      else if (c[i] == c[j])
        ;
      else {
        f = false;
        break;
      }
      i++;
      j--;
    }
    if (i == j && c[i] == 2) ans += min(a[0], a[1]);
    if (f)
      printf("%lld\n", ans);
    else
      printf("-1\n");
  }
  return 0;
}
