/*
 * In The Name Of ALLAH
 * created by Harolinch
 */
#include <iostream>
#include <fstream>
#include <string>
#include <sstream>
#include <iomanip>

#include <algorithm>
#include <list>
#include <vector>
#include <stack>
#include <deque>
#include <queue>
#include <set>
#include <map>
#include <bitset>
#include <numeric>

#include <math.h>
#include <stdlib.h>
#include <assert.h>
#include <limits.h>
#include <memory.h>
#include <ctype.h>
#include <string.h>
using namespace std;


#define rep(i, a, n) for (int i = a; i <= n; i++)


#define MAX5 100005


int freq[MAX5];
class Solution
{
public:
    void test_case_clear() {}

    void test_case(std::istream &in, std::ostream &out)
    {
        int n, q;
        in >> n >> q;
        string s;
        in >> s;
        rep(i, 0, n - 1) {
            freq[i] = (s[i] - 'a') + 1;
        }

        rep(i, 1, n - 1) {
            freq[i] += freq[i - 1];
        }

        while(q--) {
            int l, r;
            in >> l >> r;
            l--;
            r--;
            int outer = freq[r];
            int inner = l - 1 >= 0 ? freq[l - 1] : 0;
            out << outer - inner << endl;
        }
        test_case_clear();
    }

    void solve(std::istream &in, std::ostream &out)
    {
        int tests = 1;
        //in >> tests;
        while (tests--)
        {
            test_case(in, out);
        }
        return;
    }
};

void solve(std::istream &in, std::ostream &out)
{
    out << std::setprecision(12);
    Solution solution;
    solution.solve(in, out);
}


int main() {
    
    ios_base::sync_with_stdio(0);
    cin.tie(0);


    istream& in = cin;


    ostream& out = cout;

    solve(in, out);
    return 0;
}


