#include <bits/stdc++.h>

using namespace std;
long long int a[5000000],b[5000000],c[500000],d[500000];
bool pri (int a)
{
    if (a==1)return 0;
    for (int i=2;i*i<=a;i++)
    {
        if (a%i==0)
        {
            return 0;
        }
    }
    return 1;
}
long long po(int a,int b)
{
    int n=1;
    while (b--)n*=a;
    return n;
}
int main()
{
    int n,q,c,b;
    cin>>n>>q;
    string s;
    cin>>s;
    a[0]=int(s[0])-int('a')+1;
    for (int i=1;i<n;i++)
    {
        a[i]=a[i-1]+int(s[i])-int('a')+1;
    }
    while (q--)
    {
        cin>>c>>b;
        cout<<a[b-1]-a[c-2]<<endl;
    }
    /*
    int n,t;
    cin>>t;
    while (t--)
    {
        int a,b;
        cin>>n>>a>>b;
        int o=b/a-1;
        cout<<(n-1)*o*2<<endl;
    }*/
    return 0;
}
