#include <bits/stdc++.h>
int N, M = 0, ans = 0;
int B[100], c[26], t[100];
std::string s;
int main() {
  memset(c, 0, sizeof c);
  std::cin >> N >> s;
  for (int i = 0; i < N; i++) {
    std::cin >> B[i];
    ans += B[i];
  }
  for (int i = 0; i < N / 2; i++) {
    if (s[i] == s[N - i - 1]) {
      c[(s[i] - 97)]++;
      M++;
      ans -= std::min(B[i], B[N - i - 1]);
    }
  }
  for (int i = 0; i < 26; i++) {
    if (2 * c[i] > M) {
      int k = 0;
      for (int j = 0; j < N / 2; j++) {
        if (s[j] != (char)(i + 97) && s[N - j - 1] != (char)(i + 97) &&
            s[j] != s[N - j - 1])
          t[k++] = std::min(B[j], B[N - j - 1]);
      }
      std::sort(t, t + k);
      for (int j = 0; j < 2 * c[i] - M; j++) ans -= t[j];
    }
  }
  std::cout << ans << "\n";
  return 0;
}
