#include <bits/stdc++.h>
 #define endl "\n"

using namespace std;

using ll = long long;
const ll inf =1e12;
void solve()
{
    ll n,q,i,br,res=0 ,oduz1,oduz2,l,r;
    string s;
    cin >> n >> q;
    cin >> s;
    while(q--)
    {
        cin >> l >> r;
        res=r-l+1;
        cout << (res/2) * ((res+1)/2) << endl;
    }

}



int main()
{
    ios_base::sync_with_stdio(false);
   cin.tie(NULL);
    ll t=1;
    //cin >> t;
    while(t--)
    {
        solve();
    }
}