//Starting In The Name Of ALLAH
#include<bits/stdc++.h>
#define  f(i,n) for(i=0; i<n; i++)
#define  ll   long long int
#define  db   double
#define  endl '\n'
#define  yes  cout<<"YES\n";
#define  no   cout<<"NO\n";
#define  r0   return 0 ;
#define  SR() ios_base::sync_with_stdio(false);cin.tie(NULL);
using namespace std;

int main()
{
    ll n,m,t, a,b,i,j,k,l,r;
    string s,s1,s2, s3;

      cin>>n>>m>>s;


    vector<ll>v;
    k=0;
    v.push_back(0);
    for(i=0; i<n; i++)
    {
    k+=s[i]-'a'+1;
    v.push_back(k);
    }
    //for(auto u :v)cout<<u<<" ";

    for(i=0; i<m; i++)
    {
        ll sm=0;
        cin>>a>>b;

        cout<<v[b]-v[a-1]<<endl;
    }



}
