#include <bits/stdc++.h>
int main() {
  int n, k, w;
  char arr[100010];
  int sum[100010] = {0};
  int store[100010][12] = {0};
  scanf("%d %d %d", &n, &k, &w);
  scanf("%s", arr + 1);
  int i, j;
  for (i = 1; i <= n; i++) {
    int temp = arr[i] - '0';
    sum[i] = sum[i - 1] + temp;
    for (j = 0; j < k; j++) {
      store[i][j] = store[i - 1][j];
    }
    store[i][i % k] += temp;
  }
  while (w--) {
    int p1, p2;
    scanf("%d %d", &p1, &p2);
    int cnt = 0;
    cnt += (p2 - p1 + 1) / k;
    cnt += sum[p2] - sum[p1 - 1];
    cnt -= 2 * (store[p2][p2 % k] - store[p1 - 1][p2 % k]);
    printf("%d\n", cnt);
  }
  return 0;
}
