#include <bits/stdc++.h>

using namespace std;

using ll = long long;

void solve()
{
    int n;
    int q;
    cin >> n >> q;

    string s;
    cin >> s;

    vector<array<int, 26>> pref(n + 1);
    pref[0].fill(0);
    for (int i = 0; i < n; i++)
    {
        for (int c = 0; c < 26; c++)
            pref[i + 1][c] = pref[i][c] + (c == s[i] - 'a');
    }

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

        int add = 0;
        for (int c = 0; c < 26; c++)
            add += (pref[r][c] - pref[l - 1][c]) * (c + 1);

        cout << add << '\n';
    }
}

int main()
{
    ios_base::sync_with_stdio(false), cin.tie(NULL);

    solve();

    return 0;
}
