
#include<bits/stdc++.h>

using namespace std;

#define mii   map<int,int>
#define mui  multimap<int,int>
#define  vi   vector<int>
#define si set<int>
#define ll    long long
#define umii unordered_map<int, int>
#define ss second
#define pb push_back
#define ff first
#define mp make_pair
#define pii pair<int,int>
#define vpi vector<pii>
#define pq priority_queue<int>
#define pdq priority_queue<int, vi, greater<int> >
#define prl(x) {cout<<x<<endl;}
#define single solve(0);
#define testCases int t; cin>>t; for(int z1=1; z1<=t; z1++){ solve(z1);}
#define pb    push_back
#define w(t)         int t;cin>>t;while(t--)
#define int long long
#define   fr(a,b)  for( int i=a;i<=b;i++)
#define   frj(a,b)  for( int j=a;j<=b;j++)
#define   frr(a,b)  for( int i=a;i>=b;i--)
#define fastIO ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define priarr(arr,st,en) for(int i=st;i<=en;i++)cout<<arr[i]<<" "; cout<<endl;
#define mod 1000000007
#define MOD 1000000007





// cin >> n >> m >> a;
// cout<< <<" "<< <<" ";
// if()
//   cout<<"YES\n";
// else
//   cout<<"NO\n";
//continue
//return




void solve(int test) {


  int n, c = 0, ans = 0, x, y;
  cin >> n >> x;
  string s;
  cin >> s;

  mii m;
  m[0] = 0;

  for (int i = 0; i < n; i++)
  {
    c += (s[i] - 'a' + 1);
    m[i + 1] = c;

  }
  while (x--)
  {
    int a, b;
    cin >> a >> b;

    cout << m[b] - m[a - 1] << "\n";
  }


  // cout << c  << "\n";

}



signed main()
{

#ifndef ONLINE_JUDGE
  freopen("input.txt", "r+" , stdin);

  freopen("out3.txt", "w+" , stdout);
#endif


  fastIO;

  single;

  // testCases;







}





