#include using namespace std; using ll = long long; using PI = pair; int main() { // #ifndef ONLINE_JUDGE // freopen("input.txt", "r", stdin); // #endif ios_base::sync_with_stdio(false); cin.tie(0); int t; //cin>>t; t = 1; while(t--) { int n, a, b; cin>>n>>a>>b; vector dancers(n); for(auto &v: dancers) { cin>>v; } int invalid = 0, ret = 0; for(int i = 0; i < n / 2; i++) { int left = dancers[i], right = dancers[n-1-i]; if (left == right) { if(left == 2) ret += 2*min(a, b); continue; } if(left < 2 && right < 2) { invalid = 1; break; } if(left == 2) { if(right == 0) ret += a; else ret += b; continue; } if(right == 2) { if(left == 0) ret += a; else ret += b; continue; } } if (n%2 == 1 && dancers[n/2] == 2) ret += min(a,b); if (invalid) cout<<-1<