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

#define int long long
#define ll long long

void solve() {
	int n, q;
	cin >> n >> q;
	string s;
	cin >> s;
	s = '@' + s;
	vector<int> dp (n + 5, 0);
	for(int i = 1 ; i <= n ; i++) {
		dp[i] = dp[i - 1] + s[i] - 'a' + 1;
	}
	while(q--) {
		int l, r;
		cin >> l >> r;
		cout << dp[r] - dp[l - 1] << "\n";
	}
}

signed main() {
	ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
	int t = 1;
	//cin >> t;
	while(t--)
		solve();
	return 0;
}