#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  string str;
  int n;
  long long ans = 0;
  cin >> n >> str;
  vector<int> b(n), freq(26);
  for (int &x : b) cin >> x;
  for (int i = 0; i < int(n / 2); i++) {
    if (str[i] == str[n - i - 1]) {
      freq[str[i] - 'a']++;
      ans += min(b[i], b[n - i - 1]);
    }
  }
  int need = *max_element(freq.begin(), freq.end()) * 2 -
             accumulate(freq.begin(), freq.end(), 0);
  if (need <= 0) {
    cout << accumulate(b.begin(), b.end(), 0) - ans << '\n';
    return 0;
  }
  char c = 'a' + max_element(freq.begin(), freq.end()) - freq.begin();
  vector<int> have;
  for (int i = 0; i < int(n / 2); i++) {
    if (str[i] == str[n - i - 1]) continue;
    if (c == str[i] || c == str[n - i - 1]) continue;
    have.push_back(min(b[i], b[n - i - 1]));
  }
  sort(have.begin(), have.end());
  for (int i = 0; i < int(need); i++) ans += have[i];
  cout << accumulate(b.begin(), b.end(), 0) - ans << '\n';
  return 0;
}
