#include<bits/stdc++.h>
using namespace std;
#define pi acos(-1)
#define printfl   printf("%f\n",f)
#define printd   printf("%lf\n",d)
#define printi   printf("%d\n",p)
#define printl   printf("%ld\n",l)
#define printll   printf("%lld\n",ll)
#define case cout<<"Case "<<TEST<<": "
#define forcase   for(int TEST=1;TEST<=test;TEST++)
#define max3(a,b,c) max((a,b),c)
#define min3(a,b,c) min((a,b),c)
#define newl printf("\n")
#define printd1d2 printf("%lf %lf\n",d1, d2)
#define ll long long int
void solve()
{
    ll n,q;cin>>n>>q;
    string s;cin>>s;
    map <ll,ll> mp;
    ll indx=1;
    for (ll i = 1; i <=26; i++)
        {
            mp[i-1]=i;
            
        }
   ll sum[n+1];
   sum[0]=0;
   ll l=1;
   for (ll i = 0; i < s.size(); i++)
       {
           sum[l]=sum[l-1]+mp[s[i]-'a'];
           l++;
       }
      
   for (ll i = 0; i < q; i++)
       {
           ll c,d;cin>>c>>d;
           cout<<sum[d]-sum[c-1]<<endl;
       }
     // cout<<sum[13]<<endl;
                
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
  int test;
 // cin>>test;
  //forcase
  solve();
  return 0;
}
