#include <bits/stdc++.h>
using namespace std;
typedef    vector< int > vi;
typedef    vector< vi > vvi;
//           map<int, int> g1;
//         vector< pair <int,int> > vect; 
//           make_pair(arr[i],arr1[i]
//           sort(vect.begin(), vect.end()); 
typedef pair< int,int > ii;
typedef pair< long long int ,long long int > iil;
 
#define ll long long
#define forn(x,n) for(ll x = 0; x < n; ++x)
#define forni(j,i,n) for ( ll j=i ; j<n ; j++ )
#define ff first
#define ss second
#define pb push_back
#define all(c) (c).begin(),(c).end()
#define tr(c,i) for( auto i = (c).begin(); i != (c).end(); i++)
#define edl '\n'
 
#define present(container, element) (container.find(element) != container.end())
#define cpresent(container, element) (find(all(container),element) != container.end())
#define MOD 1000000007
#define PI 3.14159265
#define filecode freopen("in.txt","r",stdin); freopen("out.txt","w",stdout);
#define IOFAST ios::sync_with_stdio(false);cin.tie(0); cout.tie(0);
#define setPrecision(n) cout << std::setprecision(n)<< std::fixed


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

	while(t--){
		solve();
	}
}













