 #include<bits/stdc++.h>
using  namespace std;

      /*-----------------DECLARATIONS-----------------*/      


#define  ll                  long long
#define  inf                  1e18   
#define  memset(a , b)       memset((a) , (b) , sizeof(a))
#define  mod                 1000000007
#define  rep(i , n)          for((i) = 0 ; (i) < n ; (i)++)
#define  N                   200005       


ll t , d , ct  , q, ans , l ,m , r , n , mx , mn , i, j , k , x , y , z , s , tests  ;

char ch ;           string ss = "" ,  str = "" ;

ll a[N] ,  b[N] ;     

void resetVars()
  {
 s = k = d = l = mx = m = mn = r = q = i = j = z = x = y = ct = ans = 0 ;
  }


#ifndef ONLINE_JUDGE  
#include "debugger.hpp"  
#else
#define dbg(...) 
#endif


     /*--------------------MAIN CODE--------------------*/      

ll pref[N][27] ;

int main(){                  

       ios_base::sync_with_stdio (false), 
        cin.tie(nullptr);       



cin >> n >> q >> ss ;

for(ch='a' ; ch <= 'z' ; ch++)
{
   for(i=0 ; i<n ; i++)
      if(ss[i] == ch) 
        pref[i+1][ch-'a'] = pref[i][ch-'a'] + 1 ;
        else pref[i+1][ch-'a'] = pref[i][ch-'a'] ;


}


while(q--)
{
  cin >> l >> r ;
ans = 0 ;
  for(ch = 'a' ; ch <='z' ; ch++)
    {
  x = pref[r][ch-'a'] - pref[l-1][ch-'a'] ;
  ans += x*(ch-'a'+1) ;

    }
cout << ans <<'\n' ;
}













return 0;
}



