#include <bits/stdc++.h>
using namespace std;
const int N = 105;
int a[N];
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int n;
  cin >> n;
  string s;
  cin >> s;
  for (int i = 0; i < n; ++i) cin >> a[i];
  int ans = accumulate(a, a + n, 0);
  vector<int> c(26, 0);
  for (int i = 0; i + i < n; ++i)
    if (s[i] == s[n - i - 1]) {
      c[s[i] - 'a']++;
      ans -= min(a[i], a[n - i - 1]);
    }
  int Sum = accumulate(c.begin(), c.end(), 0);
  int Max = *max_element(c.begin(), c.end());
  if (Max + Max > Sum) {
    int chr = max_element(c.begin(), c.end()) - c.begin();
    int cnt = Max + Max - Sum;
    vector<int> vec;
    for (int i = 0; i + i < n; ++i)
      if (s[i] != s[n - i - 1]) {
        char l = s[i];
        char r = s[n - i - 1];
        if (l == 'a' + chr) continue;
        if (r == 'a' + chr) continue;
        vec.emplace_back(min(a[i], a[n - i - 1]));
      }
    sort(vec.begin(), vec.end());
    for (int i = 0; i < cnt; ++i) ans -= vec[i];
  }
  cout << ans << endl;
}
