#include <bits/stdc++.h>
using namespace std;
const int MAX_N = 100000;
const int MAX_K = 10;
char s[MAX_N + 4];
int css[MAX_N + 1], dss[MAX_K][MAX_N + 1];
int main() {
  int n, k, w;
  scanf("%d%d%d%s", &n, &k, &w, s);
  for (int i = 0; i < n; i++) {
    int d = (i < n) ? s[i] - '0' : 0;
    int e = i % k;
    css[i + 1] = css[i] + d;
    for (int j = 0; j < k; j++) dss[j][i + 1] = dss[j][i] + (j == e ? d : 0);
  }
  while (w--) {
    int l, r;
    scanf("%d%d", &l, &r);
    l--;
    int e = (l + k - 1) % k;
    int sum = (css[r] - css[l]) + (r - l) / k - (dss[e][r] - dss[e][l]) * 2;
    printf("%d\n", sum);
  }
  return 0;
}
