#include <bits/stdc++.h>
using namespace std;
const int N = 1000050;
const long long Mod = 1000000007;
const int inf = 0x3f3f3f3f;
int arr[100];
int main(int argc, const char* argv[]) {
  int n, a, b;
  scanf("%d%d%d", &n, &a, &b);
  for (int i = 1; i < ((n) + 1); i++) {
    scanf("%d", arr + i);
  }
  bool flag = true;
  int ret = 0;
  for (int i = 1; i < ((n / 2) + 1); i++) {
    int o = n + 1 - i;
    if (arr[i] == arr[o]) {
      if (arr[i] < 2) {
        continue;
      }
      ret += 2 * (a < b ? a : b);
    } else {
      if (arr[i] == 2) {
        ret += arr[o] == 0 ? a : b;
      } else if (arr[o] == 2) {
        ret += arr[i] == 0 ? a : b;
      } else {
        flag = false;
        break;
      }
    }
  }
  if (n % 2 && arr[n / 2 + 1] == 2) {
    ret += a < b ? a : b;
  }
  if (!flag) {
    puts("-1");
  } else {
    printf("%d\n", ret);
  }
  return 0;
}
