/*
https://codeforces.com/problemset/problem/1515/A
*/

#include "bits/stdc++.h"
#include <sstream>
#include <string>
using namespace std;
using ll = long long int;
#define mod 1000000
#define nline '\n'
#define FOR(a,b,c)for(int i=a;i<=b;i+=c)
#define rep(n) for(int i=0;i<n;++i)
#define  PI acoss(-1);
#define DBG(n) cout << #n << ' ' << n << '\n';
#define sp ' '
#define mx 32000 
#define sh cout<<"\n";
#define pb push_back
#define pnt(n) cout<<n<<endl;
#define SIZE 1000000
// Template end here
void solve(){
	int n,q;cin>>n>>q;
	string s;cin>>s;
	int dp[n+1];
	dp[0]=0;
	FOR(1,n,1){
		dp[i]=dp[i-1]+(s[i-1]-'a')+1;
	}
	int l,r;
	while(q--){
		cin>>l>>r;
		cout<<dp[r]-dp[l-1]<<nline;
	}
}

int main(){
	ios::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	#ifdef OJ
		freopen("input","r",stdin);
	#endif
	solve();
	return 0;
}
