#include <bits/stdc++.h>
using namespace std;

void printVec(vector<char> f){
	for(int i=0;i<f.size();i++){
		cout << f[i];
	}
	cout << endl;
}

int main() {
	int n,q,l,r;
	string s;
	cin >> n >> q >> s;
	
	int till_ith[n+1];
	till_ith[0] = 0;
	
	for(int i=1;i<n+1;i++){
		till_ith[i] = s[i-1] - 'a' + 1 + till_ith[i-1];
	}
	while(q--){
		cin >> l >> r;
		cout << till_ith[r] - till_ith[l-1] << endl;
	}
	return 0;
}