#include<bits/stdc++.h>
#define ll long long int
#define ull unsigned long long
#define M 1000000007
using namespace std;
//#include<ext/pb_ds/assoc_container.hpp>
//#include<ext/pb_ds/tree_policy.hpp>
bool sorta(const pair<ll, ll> &a, const pair<ll, ll> &b) { return (a.second < b.second); }
//using namespace __gnu_pbds;
//#define ordered_set tree<pair<long long,long long>, null_type, less<pair<long long,long long>>, rb_tree_tag, tree_order_statistics_node_update>





int main(){
  long long t,n;

  cin>>n>>t;
  string s;
  cin>>s;
  ll arr[n+1];
  ll prev=0;
  arr[0]=0;
  for (int i = 1; i <= n; ++i)
  {
    arr[i]=arr[i-1]+(s[i-1]-'a'+1);
    //cout<<"Yeh "<<arr[i]<<endl;
  }
  
  
  while(t--){
  ll l,r;
  cin>>l>>r;
  ll count=arr[r]-arr[l-1];
  

  cout<<count<<endl;
}//while
}