#include <bits/stdc++.h>
using namespace std;
#define ll long long int

signed main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int t,n;
    
    cin >> n >> t;
    int arr[n];
    string s;
    cin>>s;
    arr[0]=s[0]-97+1;
    for(int i=1;i<n;i++){
        arr[i]=s[i]-97+arr[i-1]+1;
    }
    
    while (t--)
    {
        int a,b;
        int res=0;
        cin>>a>>b;
        if(a!=1){
            res+=arr[b-1]-arr[a-2];
        }
        else
            res=arr[b-1];
        
        
        cout<<res<<"\n";
        
    }
    return 0;
}
