#include <bits/stdc++.h>

using namespace std;

int main()
{
    int n, q;
    cin >> n >> q;
    string s;
    cin >> s;

    for(int i = 0; i < q; i++)
    {
        int l, r;
        cin >> l >> r;

        int a = (r - l + 1) / 2;
        int b = (r - l + 1) - a;

        cout << a * b << endl;
    }

    return 0;
}