#include "bits/stdc++.h"
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
using namespace std;

#define ll long long
#define rep(i, b) for (ll i = 0; i < b; i++)
#define fr(i, a, b) for (ll i = a; i < b; i++)
#define rev(i, b) for (ll i = b - 1; i >= 0; i--)
#define in(a, n) rep(i, n) cin >> a[i];
#define outp(a) cout << a << endl;
#define out(a, n) rep(i, n) cout << a[i] << " ";
#define MIN -1e9
#define MAX 1e9
#define PI acos(-1)
#define inp(a) \
    ll a;      \
    cin >> a;
#define endl "\n"
#define pb push_back
#define all(v) (v).begin(), (v).end()
#define vl vector<ll>
#define ff first
#define ss second
#define sz(x) ((ll)(x).size())
#define boo(x) ((x == 0) ? cout << "NO" << endl; : cout << "YES" << endl;)

typedef pair<int, int> pii;
typedef vector<pii> vii;
typedef vector<int> vi;
typedef pair<ll, ll> pll;
typedef vector<pll> vll;
typedef vector<vi> vvi;
typedef unsigned long long ull;
typedef long double lld;

//=====================================================================/
//debug zone

#ifndef ONLINE_JUDGE
#define debug(x)       \
    cerr << #x << " "; \
    _print(x);         \
    cerr << endl;
#else
#define debug(x)
#endif

void _print(ll t)
{
    cerr << t;
}
void _print(int t) { cerr << t; }
void _print(string t) { cerr << t; }
void _print(char t) { cerr << t; }
void _print(lld t) { cerr << t; }
void _print(double t) { cerr << t; }
void _print(ull t) { cerr << t; }

// template <class T, class V> void _print(pair <T, V> p);
// template <class T> void _print(vector <T> v);
// template <class T> void _print(set <T> v);
// template <class T, class V> void _print(map <T, V> v);
// template <class T> void _print(multiset <T> v);
// template <class T, class V> void _print(pair <T, V> p) {cerr << "{"; _print(p.ff); cerr << ","; _print(p.ss); cerr << "}";}
// template <class T> void _print(vector <T> v) {cerr << "[ "; for (T i : v) {_print(i); cerr << " ";} cerr << "]";}
// template <class T> void _print(set <T> v) {cerr << "[ "; for (T i : v) {_print(i); cerr << " ";} cerr << "]";}
// template <class T> void _print(multiset <T> v) {cerr << "[ "; for (T i : v) {_print(i); cerr << " ";} cerr << "]";}
// template <class T, class V> void _print(map <T, V> v) {cerr << "[ "; for (auto i : v) {_print(i); cerr << " ";} cerr << "]";}

//=====================================================================/
//Available Functions :

//1. binpow(binpow)	 2. string to int and int to string (stll)	 3. no of coprime nos before it(coprime)
//=====================================================================/

void solve()
{

    ll p, q;
    string s;
    cin >> p >> q;
    cin >> s;
    ll a[p + 1];

    rep(i, p)
    {
        if (i == 0)
        {
            a[i] = 1 + (s[i] - 'a');
        }
        else 
        a[i] = a[i - 1] + 1 + (s[i] - 'a');
    }

    rep(i, q)
    {
        ll x, y;
        cin >> x >> y;

        if ((x - 1) == 0)
            cout << a[y - 1] << endl;
        else
        {
            cout << a[y - 1] + a[x - 1] - a[x - 1] - a[x - 2] << endl;
        }
    }

    return;
}

int main()
{

#ifndef ONLINE_JUDGE
    freopen("Error.txt", "w", stderr);
#endif
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    ll tt = 1;
    //cin >> tt;
    while (tt--)
        solve();
    return 0;
}
