#include <bits/stdc++.h>
using namespace std;
int n, Q, k;
char s[100005];
int f[100005], ts, g[100005], h[100005];
int main() {
  scanf("%d%d%d", &n, &k, &Q);
  char x = getchar();
  x = getchar();
  while (x != '\n') s[++ts] = x, x = getchar();
  for (int i = 1; i <= ts; i++) f[i] = f[i - 1] + (s[i] == '1');
  for (int i = 1; i <= k; i++) g[i] = (s[i] == '0'), h[i] = (s[i] == '1');
  for (int i = k + 1; i <= ts; i++)
    g[i] = g[i - k] + (s[i] == '0'), h[i] = h[i - k] + (s[i] == '1');
  while (Q--) {
    int l, r, ans;
    scanf("%d%d", &l, &r);
    ans = f[r] - f[l - 1] + g[r] - g[l - 1] - h[r] + h[l - 1];
    printf("%d\n", ans);
  }
  return 0;
}
