/*                             हरे कृष्ण हरे कृष्ण कृष्ण कृष्ण हरे हरे
                                  हरे राम हरे राम राम राम हरे हरे                                     */
#include<bits/stdc++.h>
using namespace std;
#define pb emplace_back
#define pob pop_back
typedef long long int lli;
#define test lli t; cin>>t; while(t--)
#define ff first
#define ss second
#define F(n) for(lli i=0;i<n;i++)
#define pf pop_front
#define lb lower_bound
#define ub upper_bound
#define setbits(x)  __builtin_popcountll(x)
#define zerobits(x)  __builtin_ctzll(x)
#define bs binary_search
#define all(x) x.begin(),x.end()
#define nl "\n"
#define loop(i,s,n) for(lli i=s;i<n;i++)
#define pp(a)  for(auto x : a)  cout<<x<<" ";  cout<<nl;
#define mem(arr,x) memset(arr,x,sizeof(arr))
#define mod 1000000007
#define inf 1e18
#define tt(n) cin>>n; lli a[n]; loop(i,0,n) cin>>a[i];
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define ps(x,y) fixed<<setprecision(y)<<x

int main()
{
    fast;
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif
     lli n,i,c=1,q,l,r;
    cin>>n>>q;
    string s; cin>>s;
    lli a[100005]={0},b[26]={0};
    loop(i,0,n)
    {
        if(i>0) a[i]+=a[i-1];
        a[i]+=s[i]-'a'+1;
        // if(b[s[i]-'a']>0) a[i]+=b[s[i]-'a'];
        // else{ b[s[i]-'a']=c;c++; a[i]+=b[s[i]-'a'];}
    }
    //loop(i,0,n) cout<<a[i]<<" ";
    loop(i,0,q)
    {
        cin>>l>>r;
        if(l-1==0)
        {
            cout<<a[r-1];
        }
        else
        {
            cout<<a[r-1]-a[l-2];
        }
        cout<<nl;
    }
return 0;
}