#include <iostream>
#include <vector>
#include <map>


int main() {
    int n, q;
    std::cin >> n >> q;
    std::vector<std::vector<int>> ar('z' - 'a' + 1, std::vector<int>(n));
    char letter;
    std::cin >> letter;
    ar[letter - 'a'][0] = 1;
    for (int i = 1; i < n; ++i) {
        std::cin >> letter;
        ar[letter - 'a'][i] = ar[letter - 'a'][i - 1] + 1;
        for (int j = 0; j < 'z' - 'a' + 1; ++j) {
            if (j == letter - 'a') continue;
            ar[j][i] = ar[j][i - 1];
        }
    }
    int l, r;
    for (int i = 0; i < q; ++i) {
        std::cin >> l >> r;
        --l, --r;
        long long ans = 0;
        for (int i = 0; i < 'z' - 'a' + 1; ++i) {
            if (l == 0)
                ans += (i + 1)*ar[i][r];
            else    
                ans += (i+1)*(ar[i][r] - ar[i][l - 1]);
        }
        std::cout << ans << '\n';
    }
}
