#include <iostream>


using namespace std;


int main()
{
	int n, q;

	cin >> n >> q;

	char s[n+1];
	int x[n+1];

	for (int i = 1; i < n+1; i++)
	{
		cin >> s[i];
		x[i] = x[i-1] + s[i] - '`';

	}
	
	int l, r;

	for (int i = 0; i < q; i++)
	{
		cin >> l >> r;
		cout << (x[r]-x[l-1]) << endl;

	}
	
	
	


	return 0;
}