#include <bits/stdc++.h>
        
using namespace std;
        
int debugcnt = 0;
#define debug cout << "debug output " << "number: " << ++debugcnt << endl;
#define int long long
#define inf (int)(2e18)
// #define db double

vector<int> delta(vector<int>& l, vector<int> r) {
    for (int i = 0; i < 26; i++) r[i] -= l[i];
    return r;
}


int32_t main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    
    int n, q;
    cin >> n >> q;
    string s;
    cin >> s;
    vector<vector<int>> store(n + 1, vector<int>(26, 1e9));
    for (int i = n - 1; i >= 0; i--) {
        if (i != n - 1) { 
            store[i] = store[i + 1];
        }
        store[i][(int)(s[i] - 'a')]++;
    }
    while (q--) {
        int l, r, sz = 0;
        cin >> l >> r; --l;
        auto our = delta(store[r], store[l]);
        for (int i = 0; i < 26; i++) {
            sz += (i + 1) * our[i];
        }
        cout << sz << "\n";
    }
    return 0;
}