func_code_string: #include <bits/stdc++.h>   using namespace std;   int main() {     ios_base::sync_with_stdio(false), cin.tie(0);     int n, a, b;     cin >> n >> a >> b;     int ans = 0;     int c[n];     for (int i = 0; i < n; i++) cin >> c[i];     int st = 0;     int en = n - 1;     while (st <= en) {       if (st == en) {         if (c[st] == 2) {           if (a < b) {             c[st] = 0;             ans += a;           } else             ans += b;         }       } else if (c[st] == c[en] && c[st] != 2) {         st++, en--;         continue;       } else {         if (c[st] == 2) {           if (c[en] == 1)             ans += b, c[st] = 1;           else if (c[en] == 0)             ans += a, c[st] = 0;           else {             if (a < b) {               c[en] = 0;               c[st] = 0;               ans += 2 * a;             } else {               c[en] = 1;               c[st] = 1;               ans += 2 * b;             }           }         } else if (c[en] == 2) {           if (c[st] == 1)             ans += b, c[en] = 1;           else if (c[st] == 0)             ans += a, c[en] = 0;           else {             if (a < b) {               c[en] = 0;               c[st] = 0;               ans += 2 * a;             } else {               c[en] = 1;               c[st] = 1;               ans += 2 * b;             }           }         }       }       st++;       en--;     }     st = 0;     en = n - 1;     while (st <= en) {       if (c[st] != c[en]) {         cout << -1;         return 0;       }       st++;       en--;     }     cout << ans;     return 0;   }   