#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef double db;
#define x first
#define y second
#define bg begin()
#define ed end()
#define pb push_back
#define mp make_pair
#define sz(a) int((a).size())
#define R(i,n) for(int i(0);i<(n);++i)
#define L(i,n) for(int i((n)-1);~i;--i)
const int iinf=0x3f3f3f3f;
const ll linf=0x3f3f3f3f3f3f3f3f;
//Data
const int N=100;
int n,a[N],cnt[26];
string str;
//Flows
const int fN=78;
int fn,s,t;
vector<int> e[fN],to,fw,co;
void adde(int u,int v,int w,int c){
e[u].pb(sz(to)),to.pb(v),fw.pb(w),co.pb(+c);
e[v].pb(sz(to)),to.pb(u),fw.pb(0),co.pb(-c);
}
int pre[fN],dep[fN],q[fN],*ta,*he; bool vis[fN];
bool spfa(){
R(u,fn) dep[u]=iinf,pre[u]=-1,vis[u]=false;
for(he=ta=q,dep[*ta++=pre[s]=s]=0;ta!=he;){
int u=*he++; he-q>=fn&&(he-=fn),vis[u]=false;
for(int v:e[u])if(fw[v]&&dep[to[v]]>dep[u]+co[v])
dep[to[v]]=dep[u]+co[v],pre[to[v]]=v,
!vis[to[v]]&&(*ta++=to[v],ta-q>=fn&&(ta-=fn),vis[to[v]]=true);
}
return dep[t]^iinf;
}
pair<int,int> flow(pair<int,int> res=mp(0,0)){
while(spfa()){
int f=iinf;
for(int u=t;u^s;u=to[pre[u]^1]) f=min(f,fw[pre[u]]);
for(int u=t;u^s;u=to[pre[u]^1]) fw[pre[u]]-=f,fw[pre[u]^1]+=f;
res.x+=f,res.y+=dep[t]*f;
}
return res;
}
//Main
int main(){
ios::sync_with_stdio(0);
cin.tie(0),cout.tie(0);
cin>>n>>str,fn=(t=(s=(n>>1)+26)+1)+1;
R(i,n) cin>>a[i],cnt[str[i]-'a']++;
R(i,n>>1){
adde(s,i,2,0);
if(str[i]==str[n-1-i]){
R(c,26){
if(c^(str[i]-'a')) adde(i,(n>>1)+c,1,0);
else adde(i,(n>>1)+c,1,-max(a[i],a[n-1-i]));
}
} else {
R(c,26){
if(c==str[i]-'a') adde(i,(n>>1)+c,1,-a[i]);
else if(c==str[n-1-i]-'a') adde(i,(n>>1)+c,1,-a[n-1-i]);
else adde(i,(n>>1)+c,1,0);
}
}
}
R(c,26) adde((n>>1)+c,t,cnt[c],0);
cout<<-flow().y<<'\n';
return 0;
}