#include <bits/stdc++.h>
using namespace std;
const int N = 110, M = 30;
int n, b[N], cnt[M], tot, ans, mx;
string s;
vector<int> v;
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cin >> n >> s;
  for (int i = 0; i < n; i++) {
    cin >> b[i];
    ans += b[i];
  }
  for (int i = 0; i * 2 < n; i++) {
    if (s[i] == s[n - i - 1]) {
      cnt[s[i] - 'a']++;
      if (cnt[s[i] - 'a'] > cnt[mx]) {
        mx = s[i] - 'a';
      }
      tot++;
      ans -= min(b[i], b[n - i - 1]);
    }
  }
  for (int i = 0; i * 2 < n; i++) {
    if (s[i] != mx + 'a' && s[n - i - 1] != mx + 'a' && s[i] != s[n - i - 1]) {
      v.push_back(min(b[i], b[n - i - 1]));
    }
  }
  sort(v.begin(), v.end());
  for (int i = 0; i < 2 * cnt[mx] - tot; i++) {
    ans -= v[i];
  }
  cout << ans << '\n';
}
