#include <bits/stdc++.h>
using namespace std;
void printVec(vector<char> f){
for(int i=0;i<f.size();i++){
cout << f[i];
}
cout << endl;
}
int main() {
int n,q,l,r;
string s;
cin >> n >> q >> s;
int till_ith[n+1];
till_ith[0] = 0;
for(int i=1;i<n+1;i++){
till_ith[i] = s[i-1] - 'a' + 1 + till_ith[i-1];
}
while(q--){
cin >> l >> r;
cout << till_ith[r] - till_ith[l-1] << endl;
}
return 0;
}
I2luY2x1ZGUgPGJpdHMvc3RkYysrLmg+CnVzaW5nIG5hbWVzcGFjZSBzdGQ7Cgp2b2lkIHByaW50VmVjKHZlY3RvcjxjaGFyPiBmKXsKCWZvcihpbnQgaT0wO2k8Zi5zaXplKCk7aSsrKXsKCQljb3V0IDw8IGZbaV07Cgl9Cgljb3V0IDw8IGVuZGw7Cn0KCmludCBtYWluKCkgewoJaW50IG4scSxsLHI7CglzdHJpbmcgczsKCWNpbiA+PiBuID4+IHEgPj4gczsKCQoJaW50IHRpbGxfaXRoW24rMV07Cgl0aWxsX2l0aFswXSA9IDA7CgkKCWZvcihpbnQgaT0xO2k8bisxO2krKyl7CgkJdGlsbF9pdGhbaV0gPSBzW2ktMV0gLSAnYScgKyAxICsgdGlsbF9pdGhbaS0xXTsKCX0KCXdoaWxlKHEtLSl7CgkJY2luID4+IGwgPj4gcjsKCQljb3V0IDw8IHRpbGxfaXRoW3JdIC0gdGlsbF9pdGhbbC0xXSA8PCBlbmRsOwoJfQoJcmV0dXJuIDA7Cn0=