#include <bits/stdc++.h>
using namespace std;
int n, k, w;
int suma[1000000];
int sumak[1000000];
int a[1000000];
int main() {
  cin >> n >> k >> w;
  for (int i = 1; i <= n; i++) {
    char c;
    cin >> c;
    a[i] = c - '0';
    suma[i] = suma[i - 1] + a[i];
    sumak[i] = a[i];
    if (i >= k) sumak[i] += sumak[i - k];
  }
  for (int i = 0; i < w; i++) {
    int l, r;
    cin >> l >> r;
    int sum = suma[r] - suma[l - 1];
    int sumk = sumak[r] - sumak[l - 1];
    cout << (r - l + 1) / k - sumk + sum - sumk << endl;
  }
}
