#include<bits/stdc++.h>
using namespace std;
void ck(string s)
{
string s1=“abcdefghijklmnopqrstuvwxyz”;
int len;
string s2=s;
int pos=0;
long int sum=0;
sort(s2.begin(),s2.end());
len=s1.length();
int i;
for(i=0;i<len;i++)
{
pos=s2.find(s1[i]);
if(pos<0)
{
sum=sum+s1[i]-96;
}
s2.erase(std::remove(s2.begin(), s2.end(), s1[i]), s2.end());
}
cout<<sum<<endl;
}
int main()
{
int n=10;
cin>>n;
string s,s2;
while(n>0)
{
getline(cin,s2); //doesn't execute the first time :/
getline(cin,s);
ck(s);
n--;
}
return 0;
}