#include <bits/stdc++.h>

using namespace std;

int main()
{
    std::ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int n,q;
    cin >> n >> q;
    string s;
    cin >> s;
    string t = "";
    for(int i = 0; i < n; i++)
    {
        t += '?';
    }
    if(s == t)
    {
        for(int i = 0; i < q; i++)
        {
            int a,b;
            cin >> a >> b;
            int duzina = b-a+1;
            if(duzina % 2 == 0){
                cout << (duzina/2)*(duzina/2) << endl;
            }
            if(duzina % 2 == 1){
                cout << (duzina/2)*(duzina/2+1) << endl;
            }
        }
    }
    else{
        vector<int> v(0);
        for(int i = 0; i < q; i++){
            int a,b;
            cin >> a >> b;
            int duzina = b-a+1;
        }
    }
}