#include <bits/stdc++.h>

using namespace std;

int main()
{
    int n;
    int m;
    cin>>n>>m;
    string k;
    cin>>k;
    int x;
    int y;
    for (int i=0;i<m;i++){
        cin>>x>>y;
        if ((y-x+1)%2==0){
            cout<<(y-x+1)*(y-x+1)/4<<endl;
        }
        else{
            cout<<(y-x)*(y-x+2)/4<<endl;
        }
    }
    return 0;
}