#include <bits/stdc++.h>
using namespace std;
int n, m, k, l, r;
char g[1 << 20];
int com[1 << 20];
int s[100000][10];
int Abs(int x) { return x < 0 ? -x : x; }
int main() {
  scanf("%d", &n);
  scanf("%d", &k);
  scanf("%d", &m);
  scanf("%s", g);
  for (int i = 0; i < n; ++i) {
    com[i] = (i) ? com[i - 1] + g[i] - '0' : g[i] - '0';
    s[i][i % k] = g[i] - '0';
    if (i >= k) s[i][i % k] += s[i - k][i % k];
  }
  while (m--) {
    scanf("%d%d", &l, &r);
    int need = (r - l + 1) / k;
    --l;
    --r;
    int all = com[r] - com[l] + (g[l] == '1');
    l += k - 1;
    int cur = s[r][r % k] - s[l][l % k] + (g[l] == '1');
    all -= cur;
    printf("%d\n", all + Abs(cur - need));
  }
}
