#include <bits/stdc++.h>
using namespace std;
int N, K, W, acc[100002];
char S[100002];
int main() {
  scanf("%d %d %d %s", &N, &K, &W, S);
  for (int i = 1; i <= N; i++) {
    if (i - K >= 0) acc[i] = acc[i - K];
    acc[i] += (S[i - 1] == '1');
  }
  for (int i = 0; i < W; i++) {
    int L, R, ret = 0;
    scanf("%d %d", &L, &R);
    ret += (R - L + 1) / K - (acc[R] - acc[L - 1]);
    for (int j = 1; j < K; j++) {
      int in = acc[R - j];
      if (L - 1 - j >= 0) in -= acc[L - 1 - j];
      ret += in;
    }
    printf("%d\n", ret);
  }
}
