#include<bits/stdc++.h>
#define ll long long
#define ld long double
#define F first
#define S second
#define ii pair<int,int>
using namespace std;

const ll MOD=1e9+7;
const ld eps=1e-9;
const int N=2e5+10;
int a[N];
void solve(){
    int n,k=0,m;
	scanf("%d%d",&n,&k);
	char ch[n];
	scanf("%s",ch);
	string s=ch;
	for(int i=0;i<n;i++){
		a[i]=((i>0)?a[i-1]:0)+(int)(s[i]-'a')+1;
	}
	while(k--){
		int l,r;
		scanf("%d%d",&l,&r);
		printf("%d\n",a[r-1]-((l-2<0)?0:a[l-2]));
	}
}

int main(){
    int t=1;
    //scanf("%d",&t);
    while(t--){
        solve();
    }


}
