#include <bits/stdc++.h>
using namespace std;
char str[100003];
int pre[100003];
int main() {
  int n, k, w;
  cin >> n >> k >> w;
  scanf("%s", str + 1);
  for (int i = 1; i <= n; i++) {
    if (i - k > 0) {
      pre[i] = pre[i - k] + (str[i] == '1');
    } else
      pre[i] = (str[i] == '1');
  }
  for (int i = 1; i <= w; i++) {
    int l, r;
    scanf("%d%d", &l, &r);
    int ans = 0;
    for (int i = 1; i < k; i++) {
      if (l + i - k - 1 > 0)
        ans += (pre[r + i - k] - pre[l + i - k - 1]);
      else
        ans += pre[r + i - k];
    }
    ans += ((r - l + 1) / k - (pre[r] - pre[l - 1]));
    printf("%d\n", ans);
  }
}
