#include <bits/stdc++.h>
int n, k, w, q, i, j, l, r;
int f[15][100005], a[100005];
char str[100005];
int main() {
  scanf("%d%d%d", &n, &k, &w);
  scanf("%s", str);
  for (i = 0; i < n; i++) a[i + 1] = str[i] - '0';
  for (i = 1; i <= k; i++) {
    for (j = i; j <= n; j++) {
      f[i][j] = f[i][j - 1];
      if ((j - i + 1) % k == 0 && a[j] != 1)
        f[i][j]++;
      else if ((j - i + 1) % k != 0 && a[j] != 0)
        f[i][j]++;
    }
  }
  for (i = 1; i <= w; i++) {
    scanf("%d%d", &l, &r);
    q = (l - 1) % k + 1;
    printf("%d\n", f[q][r] - f[q][l - 1]);
  }
}
