#include<cstdio>
#include<cstring>
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<set>
#include<map>
#include<string>
#include<cstdlib>
#include<ctime>
#define rep(i,a,n) for(int i=(int)(a);i<(int)(n);++i)
#define repb(i,a,n) for(int i=(int)(a);i<=(int)(n);++i)
#define ll long long
#define inf 0x3f3f3f3f
using namespace std;
template<class TT>
inline void read(TT& n)
{
    TT X=0,w=1;char ch = -1;
    while(ch<'0' ||ch>'9'){if(ch=='-')w=-1;ch=getchar();}
    while(ch>='0' &&ch<='9'){X = (X<<3)+(X<<1)+ch-'0';ch=getchar();}
    n = X*w;
}
template<class TT>
inline void read(TT &a,TT &b){read(a),read(b);}
template<class TT>
inline void read(TT &a,TT &b,TT &c){read(a),read(b),read(c);}
char s[10000010];
int dp[1000010];
void solve()
{
    int a,b;read(a,b);
    cin>>s;
    int d = strlen(s);
    for(int i=1;i<=d;++i)
    {
        dp[i] = s[i-1]-'a'+1;
        if(i)dp[i]+=dp[i-1];
    }
    while(b--)
    {
        int l,r;cin>>l>>r;
        cout<<dp[r]-dp[l-1]<<endl;
    }
}
int main()
{
    //freopen("in.txt","r",stdin);
    //freopen("out.txt","w",stdout);
    solve();
    return 0;
}
