#include <bits/stdc++.h>
static const int Size = 26;
int main(int argc, const char* argv[]) {
  int n;
  std::cin >> n;
  std::string s;
  std::cin >> s;
  std::vector<int> v(n);
  for (int i = 0; i < n; i++) std::cin >> v[i];
  int result = 0;
  for (int i = 0; i < n; i++) result += v[i];
  int count = 0;
  std::vector<int> t(Size);
  for (int i = 0; i < n / 2; i++) {
    if (s[i] == s[n - i - 1]) {
      count++;
      t[s[i] - 'a']++;
      result -= std::min(v[i], v[n - i - 1]);
    }
  }
  for (int i = 0; i < Size; i++) {
    if (2 * t[i] > count) {
      char c = 'a' + i;
      int r = t[i] - count + t[i];
      std::vector<int> p;
      for (int j = 0; j < n / 2; j++)
        if (s[j] != s[n - j - 1] && s[j] != c && s[n - j - 1] != c)
          p.push_back(std::min(v[j], v[n - j - 1]));
      std::sort(p.begin(), p.end());
      for (int j = 0; j < r; j++) result -= p[j];
    }
  }
  std::cout << result << std::endl;
  return 0;
}
