#include<bits/stdc++.h>
using namespace std;
int main(){
    int n,q;
    cin>>n>>q;
    string s;
    cin>>s;
    vector<pair<int,int>>a(q);
    for(int i=0;i<n;i++){
        cin>>a[i].first>>a[i].second;
    }
    int br;
    int l;
    int r;
    for(int i=0;i<n;i++){
        br=0;
        l=0;
        r=0;
        br+=a[i].second-a[i].first+1;
        l=br/2;
        if(br%2!=0){
            r=br/2+1;
        }
        else{
            r=br/2;
        }
        cout<<l*r<<endl;
    }
}