
#include <iostream>
#include<map>
#include<cstdio>
using namespace std;
int main()
{
	int n, q;
	cin >> n >> q;
	string cadena;
	cin >> cadena;
	int l, r;
	map<char, int> mapa;
	for (int i = 0; i < 26; i++) {
		mapa['a' + i] = i + 1;
	}
	int suma[100002];
	suma[0] = 0;
	for (int i = 1; i <= cadena.size(); i++) {
		suma[i] = suma[i - 1] + mapa[cadena[i - 1]];
	}
	for (int i = 0; i < q; i++) {
		scanf("%d%d", &l, &r);
		printf("%d\n", suma[r] - suma[l - 1]);
	}
}

