#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using PI = pair<int,int>;
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<int> 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<<endl;
else cout<<ret<<endl;
}
return 0;
}
{"html5":"htmlmixed","css":"css","javascript":"javascript","php":"php","python":"python","ruby":"ruby","lua":"text\/x-lua","bash":"text\/x-sh","go":"go","c":"text\/x-csrc","cpp":"text\/x-c++src","diff":"diff","latex":"stex","sql":"sql","xml":"xml","apl":"apl","asterisk":"asterisk","c_loadrunner":"text\/x-csrc","c_mac":"text\/x-csrc","coffeescript":"text\/x-coffeescript","csharp":"text\/x-csharp","d":"d","ecmascript":"javascript","erlang":"erlang","groovy":"text\/x-groovy","haskell":"text\/x-haskell","haxe":"text\/x-haxe","html4strict":"htmlmixed","java":"text\/x-java","java5":"text\/x-java","jquery":"javascript","mirc":"mirc","mysql":"sql","ocaml":"text\/x-ocaml","pascal":"text\/x-pascal","perl":"perl","perl6":"perl","plsql":"sql","properties":"text\/x-properties","q":"text\/x-q","scala":"scala","scheme":"text\/x-scheme","tcl":"text\/x-tcl","vb":"text\/x-vb","verilog":"text\/x-verilog","yaml":"text\/x-yaml","z80":"text\/x-z80"}