#include <bits/stdc++.h>

using namespace std;

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

    if(count(s.begin(), s.end(), '?') == s.size())
    {
        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;
        }
    }
    else if(count(s.begin(), s.end(), '?') == 0)
    {
        
    }

    return 0;
}