#include <bits/stdc++.h>
using namespace std;
#ifdef LOCAL
#include "debug.h"
#else
#define deb(...)
#endif
#define endl "\n"
#define pb push_back
#define int long long
#define ll long long
#define pii pair<int,int>
#define F first
#define S second
#define all(c) c.begin(),c.end()
#define read(v) for(auto &it:v) cin>>it;
const int inf = 1e18;
const int N   = 2e5 + 5;
const int mod = 1000000007;

void test_case() {
    int n, k;
    cin >> n >> k;
    string s;
    cin >> s;
    vector <int> pref(n);
    int sum = 0;
    for (int i = 0; i < n; i++) {
        sum += (s[i] - 'a' + 1);
        pref[i] = sum;
    }
    while (k--) {
        int l, r;
        cin >> l >> r;
        l--;
        r--;
        cout << pref[r] - pref[l] + (s[l] - 'a' + 1) << endl;
    }


}

int32_t main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
    int  t = 1;
    // cin >> t;
    while (t--)test_case();
    return 0;
}