#include <bits/stdc++.h>
using namespace std;
int a[100007], f[20][100007];
char s[100007];
int main() {
  int n, k, w, x, y, z;
  while (~scanf("%d%d%d", &n, &k, &w)) {
    scanf("%s", s);
    memset(a, 0, sizeof(a));
    memset(f, 0, sizeof(f));
    for (int i = 0; i < n; i++)
      if (s[i] == '1')
        a[i + 1] = 1;
      else
        a[i + 1] = 0;
    for (int i = 0; i < k; i++) {
      for (int j = i + 1; j <= n; j++) {
        f[i][j] = f[i][j - 1];
        if ((j - i) % k == 0 && a[j] != 1)
          f[i][j]++;
        else if ((j - i) % k != 0 && a[j] != 0)
          f[i][j]++;
      }
    }
    while (w--) {
      cin >> x >> y;
      z = (x - 1) % k;
      printf("%d\n", f[z][y] - f[z][x - 1]);
    }
  }
  return 0;
}
