#include <bits/stdc++.h>
using namespace std;
const long long maxn = 2e5 + 100;
const long long mod = 1e9 + 7;
const long long base = 1e18;
long long b[maxn];
long long a[maxn];
long long cnt[maxn];
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  if (fopen("TRIPLES.inp", "r")) {
    freopen("TRIPLES.inp", "r", stdin);
    freopen("TRIPLES.out", "w", stdout);
  }
  long long n;
  cin >> n;
  string s1;
  cin >> s1;
  s1 = " " + s1;
  for (int i = 1; i <= n; i++) {
    b[i] = s1[i] - 'a' + 1;
  }
  long long ans = 0;
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
    ans += a[i];
  }
  long long res = 0;
  long long mx = 0;
  long long pos;
  for (int i = 1; i <= n / 2; i++) {
    if (b[i] == b[n - i + 1]) {
      res++;
      ans -= min(a[i], a[n - i + 1]);
      cnt[b[i]]++;
      if (cnt[b[i]] > mx) {
        mx = cnt[b[i]];
        pos = b[i];
      }
    }
  }
  if (mx * 2 <= res) {
    cout << ans;
    return 0;
  }
  long long cl = mx - (res - mx);
  vector<long long> vt;
  for (int i = 1; i <= n / 2; i++) {
    if (b[i] == b[n - i + 1]) continue;
    if (b[i] == pos || b[n - i + 1] == pos) continue;
    vt.push_back(min(a[i], a[n - i + 1]));
  }
  sort(vt.begin(), vt.end());
  for (int i = 0; i < cl; i++) {
    ans -= vt[i];
  }
  cout << ans << endl;
}
