#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;

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

        cout << a * b << endl;
    }

    return 0;
}