#include<iostream>
using namespace std;
int main ()
{

    string s;
    int n,c,r,q,res=0,br=1;
    cin>>n>>c>>q;
    int ln[q],rn[q],a[n];
    cin>>s;
    for (int i=0;i<q;i++)
    {
        cin>>ln[i]>>rn[i];
    }
    for (int o=0;o<q;o++)
    {
        res=0;
        br=1;
        int l = ln[o],r = rn[o];
        for (int i=l-1;i<=r-1;i++)
        {
            if (s[i]=='0')
                s[i]='1';
            else
                s[i]='0';
        }
        for (int i=0;i<n;i++)
        {
            while (s[i+1]=='1' && i<n-1)
            {
                br++;
                i++;
            }
            if (br/c>=1)
                res+=c;
            else
            {
                res+=br;
            }

            br=1;
        }
        cout<<res<<endl;
    }
    return 0;
}