#include <bits/stdc++.h>
using namespace std;
 
#define all(cont) cont.begin(), cont.end()
#define rall(cont) cont.end(), cont.begin()
#define FOREACH(it, l) for (auto it = l.begin(); it != l.end(); it++)
#define IN(A, B, C) assert(B <= A && A <= C)
#define SORT(v) sort(v.begin(), v.end())
#define MP make_pair
#define PB push_back
#define INF (int)1e9
#define EPS 1e-9
#define PI 3.1415926535897932384626433832795
#define MOD 1000000007
const double pi = acos(-1.0);
typedef long int int32;
typedef unsigned long int uint32;
typedef long long int int64;
typedef unsigned long long int uint64;
const int N = 1e5 + 5;
 
void solve() {
        int64 n, q, l, r;
        cin>>n>>q;
        string s;
        cin>>s;
        vector<int64> v, v1(n);
        while(n--){
            v.PB(s[s.size()-n-1]-96);
        }
        partial_sum(v.begin(), v.end(), v1.begin());
        while(q--){
            cin>>l>>r;
            cout<<v1[r-1]-v1[l-1]+v[l-1]<<"\n";
        }
        
        
}
 
int main() {
        solve();
    return 0;
}