#include<bits/stdc++.h>
using namespace std;

int sum[100000+6];

int main()
{
    int n, q, total = 0;
    string s;
    cin >> n >> q >> s;

    for(int i = 0; i < n; i++){
        total += s[i] - 'a' + 1;
        sum[i] = total;
    }

    for(int i = 0; i < q; i++){
        int l, r, res = 0;
        cin >> l >> r;
        l--; r--;

        if(l > 0 )
            res = sum[r] - sum[l - 1];
        else
            res = sum[r];
        cout << res << endl;
    }
    return 0;
}